forked from osmocom/wireshark
Fix Bug #6276: "Find Packet" Bug:
'The search query e.g. (ASCII or hex) "abac" doesn't find the packet(s) containing the string "ababac".' https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6726 svn path=/trunk/; revision=40483
This commit is contained in:
parent
dbffa9eaef
commit
85c1195fe3
53
file.c
53
file.c
|
@ -2996,22 +2996,28 @@ match_ascii_and_unicode(capture_file *cf, frame_data *fdata, void *criterion)
|
|||
|
||||
result = MR_NOTMATCHED;
|
||||
buf_len = fdata->pkt_len;
|
||||
for (i = 0; i < buf_len; i++) {
|
||||
i = 0;
|
||||
while (i < buf_len) {
|
||||
c_char = cf->pd[i];
|
||||
if (cf->case_type)
|
||||
c_char = toupper(c_char);
|
||||
if (c_char != 0) {
|
||||
if (c_char != '\0') {
|
||||
if (c_char == ascii_text[c_match]) {
|
||||
c_match++;
|
||||
c_match += 1;
|
||||
if (c_match == textlen) {
|
||||
result = MR_MATCHED;
|
||||
cf->search_pos = i; /* Save the position of the last character
|
||||
for highlighting the field. */
|
||||
break;
|
||||
}
|
||||
} else
|
||||
}
|
||||
else {
|
||||
g_assert(i>=c_match);
|
||||
i -= c_match;
|
||||
c_match = 0;
|
||||
}
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -3036,21 +3042,28 @@ match_ascii(capture_file *cf, frame_data *fdata, void *criterion)
|
|||
|
||||
result = MR_NOTMATCHED;
|
||||
buf_len = fdata->pkt_len;
|
||||
for (i = 0; i < buf_len; i++) {
|
||||
i = 0;
|
||||
while (i < buf_len) {
|
||||
c_char = cf->pd[i];
|
||||
if (cf->case_type)
|
||||
c_char = toupper(c_char);
|
||||
if (c_char == ascii_text[c_match]) {
|
||||
c_match++;
|
||||
c_match += 1;
|
||||
if (c_match == textlen) {
|
||||
result = MR_MATCHED;
|
||||
cf->search_pos = i; /* Save the position of the last character
|
||||
for highlighting the field. */
|
||||
break;
|
||||
}
|
||||
} else
|
||||
}
|
||||
else {
|
||||
g_assert(i>=c_match);
|
||||
i -= c_match;
|
||||
c_match = 0;
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -3074,21 +3087,27 @@ match_unicode(capture_file *cf, frame_data *fdata, void *criterion)
|
|||
|
||||
result = MR_NOTMATCHED;
|
||||
buf_len = fdata->pkt_len;
|
||||
for (i = 0; i < buf_len; i++) {
|
||||
i = 0;
|
||||
while (i < buf_len) {
|
||||
c_char = cf->pd[i];
|
||||
if (cf->case_type)
|
||||
c_char = toupper(c_char);
|
||||
if (c_char == ascii_text[c_match]) {
|
||||
c_match++;
|
||||
i++;
|
||||
c_match += 1;
|
||||
if (c_match == textlen) {
|
||||
result = MR_MATCHED;
|
||||
cf->search_pos = i; /* Save the position of the last character
|
||||
for highlighting the field. */
|
||||
break;
|
||||
}
|
||||
} else
|
||||
i += 1;
|
||||
}
|
||||
else {
|
||||
g_assert(i>=(c_match*2));
|
||||
i -= c_match*2;
|
||||
c_match = 0;
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -3112,17 +3131,23 @@ match_binary(capture_file *cf, frame_data *fdata, void *criterion)
|
|||
|
||||
result = MR_NOTMATCHED;
|
||||
buf_len = fdata->pkt_len;
|
||||
for (i = 0; i < buf_len; i++) {
|
||||
i = 0;
|
||||
while (i < buf_len) {
|
||||
if (cf->pd[i] == binary_data[c_match]) {
|
||||
c_match++;
|
||||
c_match += 1;
|
||||
if (c_match == datalen) {
|
||||
result = MR_MATCHED;
|
||||
cf->search_pos = i; /* Save the position of the last character
|
||||
for highlighting the field. */
|
||||
break;
|
||||
}
|
||||
} else
|
||||
}
|
||||
else {
|
||||
g_assert(i>=c_match);
|
||||
i -= c_match;
|
||||
c_match = 0;
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue