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 071b6a4ed07fe6ffb40c38a87c1c3a807794655e..79f26b7e8ec9bb6e7c4d492dd6adf247a5edd97b 100644 (file)
@@ -9,7 +9,7 @@
  * See RFCs 1905, 1906, 1909, and 1910 for SNMPv2u [historic].
  *
  * See RFCs 2570-2576 for SNMPv3
- * Updated to use the asn2eth compiler made by Tomas Kukosa
+ * Updated to use the asn2wrs compiler made by Tomas Kukosa
  * Copyright (C) 2005 - 2006 Anders Broman [AT] ericsson.com
  *
  *
@@ -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. */
@@ -1175,7 +1181,7 @@ dissect_snmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 
        /*
         * See if this looks like SNMP or not. if not, return 0 so
-        * ethereal can try som other dissector instead.
+        * wireshark can try som other dissector instead.
         */
        /* All SNMP packets are BER encoded and consist of a SEQUENCE
         * that spans the entire PDU. The first item is an INTEGER that
@@ -1296,7 +1302,7 @@ process_prefs(void)
                 * Windows.  Do the converse on non-Windows systems.  This
                 * handles cases where we've copied a preferences file
                 * between a non-Windows box and a Windows box or upgraded
-                * from an older version of Ethereal under Windows.
+                * from an older version of Wireshark under Windows.
                 */
                g_strdelimit(tmp_mib_modules, IMPORT_SEPARATOR, ENV_SEPARATOR_CHAR);