(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/tvbuff.c) |
| |
| 2757 | | | tvb_find_tvb(tvbuff_t *haystack_tvb, tvbuff_t *needle_tvb, gint haystack_offset) |
| 2758 | | | { |
| 2759 | | | guint haystack_abs_offset, haystack_abs_length; |
| 2760 | | | const guint8 *haystack_data; |
| 2761 | | | const guint8 *needle_data; |
| 2762 | | | const guint needle_len = needle_tvb->length; |
| 2763 | | | const guint8 *location; |
| 2764 | | | |
| 2765 | | | if (haystack_tvb->length < 1 || needle_tvb->length < 1) { |
| 2766 | | | return -1; |
| 2767 | | | } |
| 2768 | | | |
| 2769 | | | |
| 2770 | | | haystack_data = tvb_get_ptr(haystack_tvb, 0, -1); |
| 2771 | | | needle_data = tvb_get_ptr(needle_tvb, 0, -1); |
| 2772 | | | |
| 2773 | | | check_offset_length(haystack_tvb, haystack_offset, -1, |
| 2774 | | | &haystack_abs_offset, &haystack_abs_length); |
| 2775 | | | |
| 2776 | | | location = epan_memmem(haystack_data + haystack_abs_offset, haystack_abs_length, |
| 2777 | | | needle_data, needle_len); |
| 2778 | | | |
| 2779 | | | if (location) { |
| 2780 | | | return (gint) (location - haystack_data); |
| 2781 | | | } |
| 2782 | | | else { |
| 2783 | | | return -1; |
| 2784 | | | } |
| 2785 | | | |
| 2786 | | | return -1; |
Unreachable Computation
The highlighted code will not execute under any circumstances. This may be because of: |
|
| 2787 | | | } |
| |