diff options
author | Gerald Combs <gerald@wireshark.org> | 2005-09-19 16:23:05 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2005-09-19 16:23:05 +0000 |
commit | d2e3d4504243ae727759dd2b48dbbd7ce70a05dc (patch) | |
tree | d0d6ae60174ae75739a8b4d79e92a6889f1f87d9 /epan | |
parent | f10f911bce7904d2020162da36fd23f8d330699c (diff) |
In the SPNEGO dissector, don't call a subdissector if we don't have a TVB.
Fixes bugs 448, 449, 451, 452, 454, 456, and 461.
Add similar TVB checks to the BER dissector.
svn path=/trunk/; revision=15869
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-ber.c | 13 | ||||
-rw-r--r-- | epan/dissectors/packet-spnego.c | 5 |
2 files changed, 16 insertions, 2 deletions
diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c index 886aaab46a..c5a968759f 100644 --- a/epan/dissectors/packet-ber.c +++ b/epan/dissectors/packet-ber.c @@ -1077,6 +1077,10 @@ printf("SEQUENCE dissect_ber_sequence(%s) calling subdissector\n",name); } } #endif + if (next_tvb == NULL) { + /* Assume that we have a malformed packet. */ + THROW(ReportedBoundsError); + } count=seq->func(pinfo, tree, next_tvb, 0); #ifdef DEBUG_BER @@ -1300,7 +1304,10 @@ printf("SET dissect_ber_set(%s) calling subdissector\n",name); } } #endif - + if (next_tvb == NULL) { + /* Assume that we have a malformed packet. */ + THROW(ReportedBoundsError); + } count=cset->func(pinfo, tree, next_tvb, 0); if(count) { @@ -1513,6 +1520,10 @@ printf("CHOICE dissect_ber_choice(%s) calling subdissector len:%d\n",name,tvb_le } } #endif + if (next_tvb == NULL) { + /* Assume that we have a malformed packet. */ + THROW(ReportedBoundsError); + } count=ch->func(pinfo, tree, next_tvb, 0); #ifdef DEBUG_BER { diff --git a/epan/dissectors/packet-spnego.c b/epan/dissectors/packet-spnego.c index 3fce23f1c4..b0c33eb9bb 100644 --- a/epan/dissectors/packet-spnego.c +++ b/epan/dissectors/packet-spnego.c @@ -238,13 +238,16 @@ static int dissect_reqFlags(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, static int dissect_spnego_T_mechToken(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { - tvbuff_t *mechToken_tvb; + tvbuff_t *mechToken_tvb = NULL; offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index, &mechToken_tvb); + if (! mechToken_tvb) { + THROW(ReportedBoundsError); + } /* * Now, we should be able to dispatch after creating a new TVB. |