aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2005-04-13 21:20:23 +0000
committerGerald Combs <gerald@wireshark.org>2005-04-13 21:20:23 +0000
commitd357c745a6c55c17741d73669a138a175b3c8dd6 (patch)
tree13c7161c83fb3f78a9269e0d6650e0fa54e48861 /epan
parente3bd36c2d54d56a7c6c4ef10832319a4934226d8 (diff)
In dissect_ber_octet_string_wcb(), make sure out_tvb is non-NULL before
trying to use it so that we don't throw an assertion. Fixes bug 22. Do the same thing in dissect_ber_GeneralString(). svn path=/trunk/; revision=14065
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-ber.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c
index c1ce522086..4435fd86bd 100644
--- a/epan/dissectors/packet-ber.c
+++ b/epan/dissectors/packet-ber.c
@@ -506,10 +506,10 @@ printf("OCTET STRING dissect_ber_octet_string(%s) entered\n",name);
int dissect_ber_octet_string_wcb(gboolean implicit_tag, packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, gint hf_id, ber_callback func)
{
- tvbuff_t *out_tvb;
+ tvbuff_t *out_tvb = NULL;
offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_id, (func)?&out_tvb:NULL);
- if (func && (tvb_length(out_tvb)>0)) {
+ if (func && out_tvb && (tvb_length(out_tvb)>0)) {
if (hf_id != -1)
tree = proto_item_add_subtree(ber_last_created_item, ett_ber_octet_string);
func(pinfo, tree, out_tvb, 0);
@@ -1139,15 +1139,15 @@ printf("RESTRICTED STRING dissect_ber_octet_string(%s) entered\n",name);
int
dissect_ber_GeneralString(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, gint hf_id, char *name_string, guint name_len)
{
- tvbuff_t *out_tvb;
+ tvbuff_t *out_tvb = NULL;
offset = dissect_ber_restricted_string(FALSE, BER_UNI_TAG_GeneralString, pinfo, tree, tvb, offset, hf_id, (name_string)?&out_tvb:NULL);
if (name_string) {
- if (tvb_length(out_tvb) >= name_len) {
+ if (out_tvb && tvb_length(out_tvb) >= name_len) {
tvb_memcpy(out_tvb, name_string, 0, name_len-1);
name_string[name_len-1] = '\0';
- } else {
+ } else if (out_tvb) {
tvb_memcpy(out_tvb, name_string, 0, -1);
name_string[tvb_length(out_tvb)] = '\0';
}