diff options
author | Peter Wu <peter@lekensteyn.nl> | 2019-02-08 18:48:26 +0100 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2019-02-10 16:12:46 +0000 |
commit | 567fe966b1ca9a4c00f9989de9a38cfe8ebfbd14 (patch) | |
tree | 414a608bc93e65134e56d7ecb8a8b8420c2f7262 /extcap.c | |
parent | 80587eb0636e0e8642be504bc9cd207f37122a0b (diff) |
extcap: set G_REGEX_RAW to avoid potential crashes
None of the patterns try to match UTF-8 text. Treat the inputs as bytes
to avoid potential crashes on invalid subjects (e.g. malformed data from
an extcap binary, ADB or SSH server).
Change-Id: I6f3113cfd9da04ae3fa2b0ece7b0a3a94312830e
Ping-Bug: 14905
Reviewed-on: https://code.wireshark.org/review/31939
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'extcap.c')
-rw-r--r-- | extcap.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -770,8 +770,8 @@ extcap_pref_for_argument(const gchar *ifname, struct _extcap_arg *arg) { struct preference *pref = NULL; - GRegex *regex_name = g_regex_new("[-]+", (GRegexCompileFlags) 0, (GRegexMatchFlags) 0, NULL); - GRegex *regex_ifname = g_regex_new("(?![a-zA-Z0-9_]).", (GRegexCompileFlags) 0, (GRegexMatchFlags) 0, NULL); + GRegex *regex_name = g_regex_new("[-]+", G_REGEX_RAW, (GRegexMatchFlags) 0, NULL); + GRegex *regex_ifname = g_regex_new("(?![a-zA-Z0-9_]).", G_REGEX_RAW, (GRegexMatchFlags) 0, NULL); if (regex_name && regex_ifname) { if (prefs_find_module("extcap")) @@ -815,8 +815,8 @@ static gboolean cb_preference(extcap_callback_info_t cb_info) { GList *walker = arguments; - GRegex *regex_name = g_regex_new("[-]+", (GRegexCompileFlags) 0, (GRegexMatchFlags) 0, NULL); - GRegex *regex_ifname = g_regex_new("(?![a-zA-Z0-9_]).", (GRegexCompileFlags) 0, (GRegexMatchFlags) 0, NULL); + GRegex *regex_name = g_regex_new("[-]+", G_REGEX_RAW, (GRegexMatchFlags) 0, NULL); + GRegex *regex_ifname = g_regex_new("(?![a-zA-Z0-9_]).", G_REGEX_RAW, (GRegexMatchFlags) 0, NULL); if (regex_name && regex_ifname) { while (walker != NULL) |