From 7f097fdc9bdee9138924e000a0579e3e75370133 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Mon, 3 Mar 2008 22:28:35 +0000 Subject: [PATCH] Make sure we initialize a TVB. Fixes bug 2329. svn path=/trunk/; revision=24543 --- asn1/x509sat/x509sat.cnf | 5 ++++- docbook/release-notes.xml | 8 ++++---- epan/dissectors/packet-x509sat.c | 17 ++++++++++------- epan/dissectors/packet-x509sat.h | 2 +- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/asn1/x509sat/x509sat.cnf b/asn1/x509sat/x509sat.cnf index 34e4dc5d83..3bbd5dfab0 100644 --- a/asn1/x509sat/x509sat.cnf +++ b/asn1/x509sat/x509sat.cnf @@ -295,11 +295,14 @@ XDayOf/fifth fifth_dayof #.FN_PARS SyntaxBMPString VAL_PTR = &wide_tvb #.FN_HDR SyntaxBMPString - tvbuff_t *wide_tvb; + tvbuff_t *wide_tvb = NULL; char *string; #.END #.FN_FTR SyntaxBMPString + if (! wide_tvb) { + return offset; + } string = tvb_get_ephemeral_faked_unicode (wide_tvb, 0, tvb_length(wide_tvb) / 2, FALSE); proto_item_append_text(actx->created_item, " %s", string); diff --git a/docbook/release-notes.xml b/docbook/release-notes.xml index 5407b02346..5a3827930c 100644 --- a/docbook/release-notes.xml +++ b/docbook/release-notes.xml @@ -37,11 +37,11 @@ Wireshark Info - Wireshark could crash at any moment. - - + The X.509sat dissector could crash. + + - Versions affected: 0.2.0 to 0.99.7 + Versions affected: 0.99.5 to 0.99.8 diff --git a/epan/dissectors/packet-x509sat.c b/epan/dissectors/packet-x509sat.c index e0d595eeae..3eaaa9cb4d 100644 --- a/epan/dissectors/packet-x509sat.c +++ b/epan/dissectors/packet-x509sat.c @@ -1,7 +1,7 @@ /* Do not modify this file. */ /* It is created automatically by the ASN.1 to Wireshark dissector compiler */ /* packet-x509sat.c */ -/* ../../tools/asn2wrs.py -b -e -p x509sat -c x509sat.cnf -s packet-x509sat-template SelectedAttributeTypes.asn */ +/* ../../tools/asn2wrs.py -b -e -p x509sat -c ./x509sat.cnf -s ./packet-x509sat-template -D . SelectedAttributeTypes.asn */ /* Input file: packet-x509sat-template.c */ @@ -500,7 +500,7 @@ static const value_string x509sat_T_subset_vals[] = { static int dissect_x509sat_T_subset(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, - NULL); + NULL); return offset; } @@ -627,7 +627,7 @@ static const value_string x509sat_PreferredDeliveryMethod_item_vals[] = { static int dissect_x509sat_PreferredDeliveryMethod_item(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, - NULL); + NULL); return offset; } @@ -915,7 +915,7 @@ dissect_x509sat_T_absolute(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off static int dissect_x509sat_INTEGER(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, - NULL); + NULL); return offset; } @@ -1322,7 +1322,7 @@ dissect_x509sat_BOOLEAN(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset int dissect_x509sat_TimeZone(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, - NULL); + NULL); return offset; } @@ -1440,7 +1440,7 @@ dissect_x509sat_BitString(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs static int dissect_x509sat_Integer(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, - NULL); + NULL); return offset; } @@ -1512,7 +1512,7 @@ dissect_x509sat_SyntaxIA5String(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, in static int dissect_x509sat_SyntaxBMPString(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 298 "x509sat.cnf" - tvbuff_t *wide_tvb; + tvbuff_t *wide_tvb = NULL; char *string; offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_BMPString, @@ -1520,6 +1520,9 @@ dissect_x509sat_SyntaxBMPString(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, in &wide_tvb); #line 303 "x509sat.cnf" + if (! wide_tvb) { + return offset; + } string = tvb_get_ephemeral_faked_unicode (wide_tvb, 0, tvb_length(wide_tvb) / 2, FALSE); proto_item_append_text(actx->created_item, " %s", string); diff --git a/epan/dissectors/packet-x509sat.h b/epan/dissectors/packet-x509sat.h index be9b6ab5ad..4e599d9816 100644 --- a/epan/dissectors/packet-x509sat.h +++ b/epan/dissectors/packet-x509sat.h @@ -1,7 +1,7 @@ /* Do not modify this file. */ /* It is created automatically by the ASN.1 to Wireshark dissector compiler */ /* packet-x509sat.h */ -/* ../../tools/asn2wrs.py -b -e -p x509sat -c x509sat.cnf -s packet-x509sat-template SelectedAttributeTypes.asn */ +/* ../../tools/asn2wrs.py -b -e -p x509sat -c ./x509sat.cnf -s ./packet-x509sat-template -D . SelectedAttributeTypes.asn */ /* Input file: packet-x509sat-template.h */