Don't blow up if "asn1_string_value_decode()" supplies a null pointer as
the string because the string value is zero-length. Don't try to treat an agent address in a V1 trap as an IP address if it's not 4 bytes long. svn path=/trunk/; revision=3265
This commit is contained in:
parent
ca49be4d3e
commit
3d446c2609
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
* See RFCs 1905, 1906, 1909, and 1910 for SNMPv2u.
|
||||
*
|
||||
* $Id: packet-snmp.c,v 1.61 2001/04/06 23:12:33 guy Exp $
|
||||
* $Id: packet-snmp.c,v 1.62 2001/04/07 00:52:07 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -834,7 +834,7 @@ snmp_variable_decode(proto_tree *snmp_tree, subid_t *variable_oid,
|
|||
if (snmp_tree) {
|
||||
#ifdef HAVE_SPRINT_VALUE
|
||||
if (!unsafe) {
|
||||
variable.val.string = vb_octet_string;
|
||||
variable.val.string = SAFE_STRING(vb_octet_string);
|
||||
vb_display_string = format_var(&variable,
|
||||
variable_oid, variable_oid_length, vb_type,
|
||||
vb_length);
|
||||
|
@ -876,7 +876,8 @@ snmp_variable_decode(proto_tree *snmp_tree, subid_t *variable_oid,
|
|||
} else {
|
||||
proto_tree_add_text(snmp_tree, NullTVB, offset, length,
|
||||
"Value: %s: %.*s", vb_type_name,
|
||||
(int)vb_length, vb_octet_string);
|
||||
(int)vb_length,
|
||||
SAFE_STRING(vb_octet_string));
|
||||
}
|
||||
}
|
||||
g_free(vb_octet_string);
|
||||
|
@ -1124,8 +1125,17 @@ dissect_common_pdu(const u_char *pd, int offset, frame_data *fd,
|
|||
}
|
||||
length = asn1.pointer - start;
|
||||
if (tree) {
|
||||
proto_tree_add_text(tree, NullTVB, offset, length,
|
||||
"Agent address: %s", ip_to_str(agent_address));
|
||||
if (agent_address_length != 4) {
|
||||
proto_tree_add_text(tree, NullTVB, offset,
|
||||
length,
|
||||
"Agent address: <length is %u, not 4>",
|
||||
agent_address_length);
|
||||
} else {
|
||||
proto_tree_add_text(tree, NullTVB, offset,
|
||||
length,
|
||||
"Agent address: %s",
|
||||
ip_to_str(agent_address));
|
||||
}
|
||||
}
|
||||
g_free(agent_address);
|
||||
offset += length;
|
||||
|
|
Loading…
Reference in New Issue