aboutsummaryrefslogtreecommitdiffstats
path: root/asn1/snmp/packet-snmp-template.c
diff options
context:
space:
mode:
authorstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>2007-12-28 22:19:33 +0000
committerstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>2007-12-28 22:19:33 +0000
commitc6a2d717dab0d325387f4bbdf0559b803f9bfbb3 (patch)
tree187e87a7b5cd2525201b502c7b20b563fe8f855d /asn1/snmp/packet-snmp-template.c
parent69a67f721aa2e2b62cb9f42344d15a8522b781e1 (diff)
Fetch ObjectName and its relative oid_info before handling an eventual error
value, so we have valid values to put in the VarBind entry. Include the error note text as the label. This should fix bug 2144. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@23962 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'asn1/snmp/packet-snmp-template.c')
-rw-r--r--asn1/snmp/packet-snmp-template.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/asn1/snmp/packet-snmp-template.c b/asn1/snmp/packet-snmp-template.c
index a6e61d495b..5fed69f161 100644
--- a/asn1/snmp/packet-snmp-template.c
+++ b/asn1/snmp/packet-snmp-template.c
@@ -446,7 +446,15 @@ extern int dissect_snmp_VarBind(gboolean implicit_tag _U_,
pi_name = proto_tree_add_item(pt_varbind,hf_snmp_objectname,tvb,name_offset,name_len,FALSE);
pt_name = proto_item_add_subtree(pi_name,ett_name);
+ /* fetch ObjectName and its relative oid_info */
+ oid_bytes = ep_tvb_memdup(tvb, name_offset, name_len);
+ oid_info = oid_get_from_encoded(oid_bytes, name_len, &subids, &oid_matched, &oid_left);
+ add_oid_debug_subtree(oid_info,pt_name);
+
+ if (subids && oid_matched+oid_left) {
+ oid_string = oid_subid2string(subids,oid_matched+oid_left);
+ }
if (ber_class == BER_CLASS_CON) {
/* if we have an error value just add it and get out the way ASAP */
@@ -481,19 +489,10 @@ extern int dissect_snmp_VarBind(gboolean implicit_tag _U_,
pi = proto_tree_add_item(pt_varbind,hfid,tvb,value_offset,value_len,FALSE);
expert_add_info_format(actx->pinfo, pi, PI_RESPONSE_CODE, PI_NOTE, "%s",note);
+ strncpy (label, note, ITEM_LABEL_LENGTH);
goto set_label;
}
- /* fetch ObjectName and its relative oid_info */
- oid_bytes = ep_tvb_memdup(tvb, name_offset, name_len);
- oid_info = oid_get_from_encoded(oid_bytes, name_len, &subids, &oid_matched, &oid_left);
-
- add_oid_debug_subtree(oid_info,pt_name);
-
- if (subids && oid_matched+oid_left) {
- oid_string = oid_subid2string(subids,oid_matched+oid_left);
- }
-
/* now we'll try to figure out which are the indexing sub-oids and whether the oid we know about is the one oid we have to use */
switch (oid_info->kind) {
case OID_KIND_SCALAR: