diff options
author | Evan Huus <eapache@gmail.com> | 2013-10-04 02:21:39 +0000 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2013-10-04 02:21:39 +0000 |
commit | 76c769e50b024f568c6051a6d699ed65a71df629 (patch) | |
tree | 14809ae9c61b6733a1b3f832280d2baebe98878b /epan/dissectors/packet-gmr1_bcch.c | |
parent | 58e2773f1d582d7ea3738f66547a84c43ec20dc8 (diff) |
Initialize the SegmentType to the appropriate "Unknown" value so that if the
subdissector bails early we don't use uninitialized memory. Also add modelines.
Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9226
svn path=/trunk/; revision=52349
Diffstat (limited to 'epan/dissectors/packet-gmr1_bcch.c')
-rw-r--r-- | epan/dissectors/packet-gmr1_bcch.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/epan/dissectors/packet-gmr1_bcch.c b/epan/dissectors/packet-gmr1_bcch.c index d7ae0bd19e..7c913c851e 100644 --- a/epan/dissectors/packet-gmr1_bcch.c +++ b/epan/dissectors/packet-gmr1_bcch.c @@ -1049,6 +1049,10 @@ dissect_gmr1_bcch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (is_si1) { SystemInformation1_t *data; data = wmem_new(wmem_packet_scope(), SystemInformation1_t); + /* Initialize the type to the last element, which is an + * "Unknown", in case the dissector bails before getting this + * far. */ + data->SegmentType = array_length(SI1_SegmentChoice) - 1; csnStreamDissector(bcch_tree, &ar, CSNDESCR(SystemInformation1_t), tvb, data, ett_gmr1_bcch); col_append_fstr( pinfo->cinfo, COL_INFO, @@ -1058,6 +1062,10 @@ dissect_gmr1_bcch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } else { SystemInformation2_t *data; data = wmem_new(wmem_packet_scope(), SystemInformation2_t); + /* Initialize the type to the last element, which is an + * "Unknown", in case the dissector bails before getting this + * far. */ + data->SegmentType = array_length(SI2_SegmentChoice) - 1; csnStreamDissector(bcch_tree, &ar, CSNDESCR(SystemInformation2_t), tvb, data, ett_gmr1_bcch); col_append_fstr( pinfo->cinfo, COL_INFO, @@ -1427,3 +1435,16 @@ proto_reg_handoff_gmr1_bcch(void) { data_handle = find_dissector("data"); } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + * + * vi: set shiftwidth=8 tabstop=8 noexpandtab: + * :indentSize=8:tabSize=8:noTabs=false: + */ |