From 61d2c8f4a4fdca8f6d9055400a29f8c74580c313 Mon Sep 17 00:00:00 2001 From: Pascal Quantin Date: Thu, 22 Dec 2016 09:49:56 +0100 Subject: [PATCH] RTP: fix a possible NULL pointer dereference (CID 1397705 & 1397706) As those dissectors are registered by name, let's not make the assumption that rtp_info is always present. Change-Id: I959b8c71485471b3be4cd2e71a6d96c2d4b278ff Reviewed-on: https://code.wireshark.org/review/19381 Reviewed-by: Pascal Quantin Petri-Dish: Pascal Quantin Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- epan/dissectors/packet-rtp.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/epan/dissectors/packet-rtp.c b/epan/dissectors/packet-rtp.c index 922866272c..63e194d5cc 100644 --- a/epan/dissectors/packet-rtp.c +++ b/epan/dissectors/packet-rtp.c @@ -2476,7 +2476,7 @@ static char *ed137_squ_only = "SQU"; static char *ed137_ptt_and_squ = "PTT+SQU"; static int -dissect_rtp_hdr_ext_ed137(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ ) +dissect_rtp_hdr_ext_ed137(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { unsigned int hdr_extension_len; struct _rtp_info *rtp_info=(struct _rtp_info *)data; @@ -2491,7 +2491,9 @@ dissect_rtp_hdr_ext_ed137(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v gboolean ed137_ptt = FALSE; gboolean ed137_squ = FALSE; - rtp_info->info_is_ed137 = TRUE; + if (rtp_info != NULL) { + rtp_info->info_is_ed137 = TRUE; + } if ( tree ) { proto_item *ti; ti = proto_tree_add_item(tree, hf_rtp_hdr_ed137s, tvb, offset, hdr_extension_len * 4, ENC_NA); @@ -2590,7 +2592,7 @@ dissect_rtp_hdr_ext_ed137(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v } static int -dissect_rtp_hdr_ext_ed137a(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ ) +dissect_rtp_hdr_ext_ed137a(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { unsigned int hdr_extension_len; struct _rtp_info *rtp_info=(struct _rtp_info *)data; @@ -2605,7 +2607,9 @@ dissect_rtp_hdr_ext_ed137a(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean ed137_ptt = FALSE; gboolean ed137_squ = FALSE; - rtp_info->info_is_ed137 = TRUE; + if (rtp_info != NULL) { + rtp_info->info_is_ed137 = TRUE; + } if ( tree ) { proto_item *ti; ti = proto_tree_add_item(tree, hf_rtp_hdr_ed137s, tvb, offset, hdr_extension_len * 4, ENC_NA);