diff options
author | João Valverde <j@v6e.pt> | 2022-06-18 10:43:24 +0100 |
---|---|---|
committer | A Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org> | 2022-06-21 15:10:08 +0000 |
commit | 47348ae598127aa8bd46d5c650c6f1f77eef2bc4 (patch) | |
tree | 1179e3c8534e96408d0e54412b8554e8ec835e98 /wsutil/str_util.h | |
parent | d372ed34830e69dc15c3533d4ef65873e3404f3c (diff) |
dfilter: Add support for literal strings with null bytes
Before:
Filter: frame matches "abc\x00def"
dftest: \x00 (NUL byte) cannot be used with a regular string.
frame matches "abc\x00def"
^~~~
Filter: _ws.ftypes.string == "a string with a \0 byte"
dftest: \0 (NUL byte) cannot be used with a regular string.
_ws.ftypes.string == "a string with a \0 byte"
^~
After:
Filter: frame matches "abc\x00def"
Syntax tree:
0 TEST_MATCHES:
1 FIELD(frame)
1 PCRE(abc\0def)
Instructions:
00000 READ_TREE frame -> reg#0
00001 IF_FALSE_GOTO 3
00002 ANY_MATCHES reg#0 matches abc\0def
00003 RETURN
Filter: _ws.ftypes.string == "a string with a \0 byte"
Syntax tree:
0 TEST_ANY_EQ:
1 FIELD(_ws.ftypes.string)
1 FVALUE("a string with a \0 byte" <FT_STRING>)
Instructions:
00000 READ_TREE _ws.ftypes.string -> reg#0
00001 IF_FALSE_GOTO 3
00002 ANY_EQ reg#0 == "a string with a \0 byte" <FT_STRING>
00003 RETURN
Fixes issue #16156.
Diffstat (limited to 'wsutil/str_util.h')
-rw-r--r-- | wsutil/str_util.h | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/wsutil/str_util.h b/wsutil/str_util.h index 2d64c9d91a..cfd211d23e 100644 --- a/wsutil/str_util.h +++ b/wsutil/str_util.h @@ -151,21 +151,6 @@ gboolean isprint_utf8_string(const gchar *str, const guint length); WS_DLL_PUBLIC gboolean isdigit_string(const guchar *str); -/** - * Return the first occurrence of needle in haystack. - * - * @param haystack The data to search - * @param haystack_len The length of the search data - * @param needle The string to look for - * @param needle_len The length of the search string - * @return A pointer to the first occurrence of "needle" in - * "haystack". If "needle" isn't found or is NULL, or if - * "needle_len" is 0, NULL is returned. - */ -WS_DLL_PUBLIC -const guint8 *ws_memmem(const void *haystack, size_t haystack_len, - const void *needle, size_t needle_len); - /** Finds the first occurrence of string 'needle' in string 'haystack'. * The matching is done in a case insensitive manner. * |