diff options
author | Gerald Combs <gerald@wireshark.org> | 2009-08-08 00:27:31 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2009-08-08 00:27:31 +0000 |
commit | 7cf4114654beec5543e2592900f8c0d49e6299fd (patch) | |
tree | 244ba221b079cd2ed95f54421709883566fde3cb /epan | |
parent | d6925b130e4747a28516de386bd2d85cb032e2ee (diff) |
If we have a format error, don't try adding something to the
tree. Fixes bug 3822.
svn path=/trunk/; revision=29331
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-snmp.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/epan/dissectors/packet-snmp.c b/epan/dissectors/packet-snmp.c index fe4dfe0cf8..e49c275ca2 100644 --- a/epan/dissectors/packet-snmp.c +++ b/epan/dissectors/packet-snmp.c @@ -811,10 +811,11 @@ indexing_done: max_len = oid_info->value_type->max_len == -1 ? 0xffffff : oid_info->value_type->max_len; min_len = oid_info->value_type->min_len; - if ((int)value_len < min_len || (int)value_len > max_len) + if ((int)value_len < min_len || (int)value_len > max_len) { format_error = BER_WRONG_LENGTH; - - pi_value = proto_tree_add_item(pt_varbind,oid_info->value_hfid,tvb,value_offset,value_len,FALSE); + } else { + pi_value = proto_tree_add_item(pt_varbind,oid_info->value_hfid,tvb,value_offset,value_len,FALSE); + } } } else { switch(ber_class|(tag<<4)) { @@ -869,8 +870,10 @@ indexing_done: break; } - pi_value = proto_tree_add_item(pt_varbind,hfid,tvb,value_offset,value_len,FALSE); - expert_add_info_format(actx->pinfo, pi_value, PI_UNDECODED, PI_NOTE, "Unresolved value, Missing MIB"); + if (format_error != BER_NO_ERROR) { + pi_value = proto_tree_add_item(pt_varbind,hfid,tvb,value_offset,value_len,FALSE); + expert_add_info_format(actx->pinfo, pi_value, PI_UNDECODED, PI_NOTE, "Unresolved value, Missing MIB"); + } oid_info_is_ok = FALSE; } @@ -2595,7 +2598,7 @@ static void dissect_SMUX_PDUs_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, pro /*--- End of included file: packet-snmp-fn.c ---*/ -#line 1407 "packet-snmp-template.c" +#line 1410 "packet-snmp-template.c" guint @@ -3394,7 +3397,7 @@ void proto_register_snmp(void) { "snmp.T_operation", HFILL }}, /*--- End of included file: packet-snmp-hfarr.c ---*/ -#line 1941 "packet-snmp-template.c" +#line 1944 "packet-snmp-template.c" }; /* List of subtrees */ @@ -3434,7 +3437,7 @@ void proto_register_snmp(void) { &ett_snmp_RReqPDU_U, /*--- End of included file: packet-snmp-ettarr.c ---*/ -#line 1957 "packet-snmp-template.c" +#line 1960 "packet-snmp-template.c" }; module_t *snmp_module; static uat_field_t users_fields[] = { |