diff options
author | Jaap Keuter <jaap.keuter@xs4all.nl> | 2016-04-02 13:13:23 +0200 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2016-04-03 16:23:44 +0000 |
commit | ee9858f347f54f22fbf88d2e78a53a5ada0e7018 (patch) | |
tree | ead6ffe5c7882b1d491954cb60310b98053513f6 /wiretap | |
parent | c5b2c1e8f40cee913bd70fcc00284483b3c92fcd (diff) |
Don't deref before NULL check on pointer (CID-1358044)
When the state pointer is NULL it's defensively coded against by a
NULL pointer check. Variable initialization before should then not
dereference that pointer.
Change-Id: I0ed09e2f22be5651324f43fc3fd339d2f95684c0
Reviewed-on: https://code.wireshark.org/review/14776
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'wiretap')
-rw-r--r-- | wiretap/erf.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/wiretap/erf.c b/wiretap/erf.c index 6713766fa0..c22dc275bc 100644 --- a/wiretap/erf.c +++ b/wiretap/erf.c @@ -1639,8 +1639,8 @@ static int populate_stream_info(erf_t *erf_priv _U_, wtap *wth, union wtap_pseud wtapng_if_descr_filter_t if_filter; guint32 if_num = 0; gint32 stream_num = -1; - guint8 *tag_ptr_tmp = state->tag_ptr; - guint32 remaining_len_tmp = state->remaining_len; + guint8 *tag_ptr_tmp; + guint32 remaining_len_tmp; struct erf_if_info* if_info = NULL; memset(&if_filter, 0, sizeof(if_filter)); @@ -1648,6 +1648,9 @@ static int populate_stream_info(erf_t *erf_priv _U_, wtap *wth, union wtap_pseud if (!wth || !pseudo_header || !state || !state->if_map) return -1; + tag_ptr_tmp = state->tag_ptr; + remaining_len_tmp = state->remaining_len; + /* * XXX: We ignore parent section ID because it doesn't represent the * many-to-many relationship of interfaces and streams very well. The stream is |