aboutsummaryrefslogtreecommitdiffstats
path: root/asn1
diff options
context:
space:
mode:
authorJaap Keuter <jaap.keuter@xs4all.nl>2011-01-20 08:58:03 +0000
committerJaap Keuter <jaap.keuter@xs4all.nl>2011-01-20 08:58:03 +0000
commit3ff6167958be36440d7d358a5273680c2ff03ac0 (patch)
treee3b25c6312b6e207c532c89efa02385f7748f27a /asn1
parent705f2ede5d8300ce62fb353f032934722f3a22f2 (diff)
Allow for expert items to be actually attached somewhere.
svn path=/trunk/; revision=35594
Diffstat (limited to 'asn1')
-rw-r--r--asn1/snmp/packet-snmp-template.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/asn1/snmp/packet-snmp-template.c b/asn1/snmp/packet-snmp-template.c
index e6eac843e7..be94c9b073 100644
--- a/asn1/snmp/packet-snmp-template.c
+++ b/asn1/snmp/packet-snmp-template.c
@@ -730,23 +730,26 @@ indexing_done:
if (oid_info_is_ok && oid_info->value_type) {
if (ber_class == BER_CLASS_UNI && tag == BER_UNI_TAG_NULL) {
pi_value = proto_tree_add_item(pt_varbind,hf_snmp_unSpecified,tvb,value_offset,value_len,FALSE);
- } else {
+ } else {
+ /* Provide a tree_item to attach errors to, if needed. */
+ pi_value = pi_name;
+
if ((oid_info->value_type->ber_class != BER_CLASS_ANY) &&
(ber_class != oid_info->value_type->ber_class))
format_error = BER_WRONG_TAG;
-
- if ((oid_info->value_type->ber_tag != BER_TAG_ANY) &&
+ else if ((oid_info->value_type->ber_tag != BER_TAG_ANY) &&
(tag != oid_info->value_type->ber_tag))
format_error = BER_WRONG_TAG;
+ else {
+ max_len = oid_info->value_type->max_len == -1 ? 0xffffff : oid_info->value_type->max_len;
+ min_len = oid_info->value_type->min_len;
- 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)
+ format_error = BER_WRONG_LENGTH;
+ }
- if ((int)value_len < min_len || (int)value_len > max_len) {
- format_error = BER_WRONG_LENGTH;
- } else {
+ if (format_error == BER_NO_ERROR)
pi_value = proto_tree_add_item(pt_varbind,oid_info->value_hfid,tvb,value_offset,value_len,FALSE);
- }
}
} else {
switch(ber_class|(tag<<4)) {