Atempt to fix bug 967 crash on fuzzed SNMP capture. I can't reproduce the Bug.
[metze/wireshark/wip.git] / asn1 / snmp / packet-snmp-template.c
index 2eb159430d951a5d3bea826e589b7dde5f3014fc..79f26b7e8ec9bb6e7c4d492dd6adf247a5edd97b 100644 (file)
@@ -795,6 +795,12 @@ snmp_variable_decode(tvbuff_t *tvb, proto_tree *snmp_tree, packet_info *pinfo,tv
        offset = dissect_ber_identifier(pinfo, snmp_tree, tvb, start, &class, &pc, &ber_tag);
        offset = dissect_ber_length(pinfo, snmp_tree, tvb, offset, &vb_length, &ind);
 
+       if(vb_length == 0){
+               length = offset - start;
+               *lengthp = length;
+               return;
+       }
+
        vb_value_start = offset;
 
        /* Convert the class, constructed flag, and tag to a type. */