diff options
author | Jaap Keuter <jaap.keuter@xs4all.nl> | 2022-01-18 06:01:54 +0000 |
---|---|---|
committer | A Wireshark GitLab Utility <6629907-ws-gitlab-utility@users.noreply.gitlab.com> | 2022-01-18 06:01:54 +0000 |
commit | 3c4d2a28ea5446401ad9e75b88159f2e6d4a20cd (patch) | |
tree | 64b78aeed0b3c0a4bc66ef5fafda8becd3f346dd | |
parent | 7843c1fa894030b432c93736a8f367a68ce726de (diff) |
tvbuff: add robustness to tvb search related functions
-rw-r--r-- | epan/tvbuff.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/epan/tvbuff.c b/epan/tvbuff.c index eb9fe8261a..bcf8a183ca 100644 --- a/epan/tvbuff.c +++ b/epan/tvbuff.c @@ -2231,6 +2231,8 @@ tvb_find_guint8_generic(tvbuff_t *tvb, guint abs_offset, guint limit, guint8 nee const guint8 *result; ptr = ensure_contiguous(tvb, abs_offset, limit); /* tvb_get_ptr() */ + if (!ptr) + return -1; result = (const guint8 *) memchr(ptr, needle, limit); if (!result) @@ -2333,6 +2335,8 @@ tvb_ws_mempbrk_guint8_generic(tvbuff_t *tvb, guint abs_offset, guint limit, cons const guint8 *result; ptr = ensure_contiguous(tvb, abs_offset, limit); /* tvb_get_ptr */ + if (!ptr) + return -1; result = ws_mempbrk_exec(ptr, limit, pattern, found_needle); if (!result) |