|
|
8a419f |
983116: net-snmp query fails after update to 1:5.5-44.el6_4.2
|
|
|
8a419f |
|
|
|
8a419f |
|
|
|
8a419f |
commit e41c2f574c25d8dd273f2406eeeac19bc2ae16db
|
|
|
8a419f |
Author: Jan Safranek <jsafranek@users.sourceforge.net>
|
|
|
8a419f |
Date: Mon Aug 12 14:30:51 2013 +0200
|
|
|
8a419f |
|
|
|
8a419f |
CHANGES: snmplib: Fixed parsing of sequences.
|
|
|
8a419f |
|
|
|
8a419f |
Don't overwrite 'data' variable, it's used when parsing bulk responses.
|
|
|
8a419f |
|
|
|
8a419f |
diff --git a/snmplib/snmp_api.c b/snmplib/snmp_api.c
|
|
|
8a419f |
index 403ea2b..e67945f 100644
|
|
|
8a419f |
--- a/snmplib/snmp_api.c
|
|
|
8a419f |
+++ b/snmplib/snmp_api.c
|
|
|
8a419f |
@@ -4537,6 +4537,7 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length)
|
|
|
8a419f |
size_t four;
|
|
|
8a419f |
netsnmp_variable_list *vp = NULL;
|
|
|
8a419f |
oid objid[MAX_OID_LEN];
|
|
|
8a419f |
+ u_char *p;
|
|
|
8a419f |
|
|
|
8a419f |
/*
|
|
|
8a419f |
* Get the PDU type
|
|
|
8a419f |
@@ -4709,10 +4710,10 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length)
|
|
|
8a419f |
case ASN_INTEGER:
|
|
|
8a419f |
vp->val.integer = (long *) vp->buf;
|
|
|
8a419f |
vp->val_len = sizeof(long);
|
|
|
8a419f |
- data = asn_parse_int(var_val, &len, &vp->type,
|
|
|
8a419f |
+ p = asn_parse_int(var_val, &len, &vp->type,
|
|
|
8a419f |
(long *) vp->val.integer,
|
|
|
8a419f |
sizeof(*vp->val.integer));
|
|
|
8a419f |
- if (!data)
|
|
|
8a419f |
+ if (!p)
|
|
|
8a419f |
return -1;
|
|
|
8a419f |
break;
|
|
|
8a419f |
case ASN_COUNTER:
|
|
|
8a419f |
@@ -4721,10 +4722,10 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length)
|
|
|
8a419f |
case ASN_UINTEGER:
|
|
|
8a419f |
vp->val.integer = (long *) vp->buf;
|
|
|
8a419f |
vp->val_len = sizeof(u_long);
|
|
|
8a419f |
- data = asn_parse_unsigned_int(var_val, &len, &vp->type,
|
|
|
8a419f |
+ p = asn_parse_unsigned_int(var_val, &len, &vp->type,
|
|
|
8a419f |
(u_long *) vp->val.integer,
|
|
|
8a419f |
vp->val_len);
|
|
|
8a419f |
- if (!data)
|
|
|
8a419f |
+ if (!p)
|
|
|
8a419f |
return -1;
|
|
|
8a419f |
break;
|
|
|
8a419f |
#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
|
|
|
8a419f |
@@ -4734,37 +4735,37 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length)
|
|
|
8a419f |
case ASN_COUNTER64:
|
|
|
8a419f |
vp->val.counter64 = (struct counter64 *) vp->buf;
|
|
|
8a419f |
vp->val_len = sizeof(struct counter64);
|
|
|
8a419f |
- data = asn_parse_unsigned_int64(var_val, &len, &vp->type,
|
|
|
8a419f |
+ p = asn_parse_unsigned_int64(var_val, &len, &vp->type,
|
|
|
8a419f |
(struct counter64 *) vp->val.
|
|
|
8a419f |
counter64, vp->val_len);
|
|
|
8a419f |
- if (!data)
|
|
|
8a419f |
+ if (!p)
|
|
|
8a419f |
return -1;
|
|
|
8a419f |
break;
|
|
|
8a419f |
#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
|
|
|
8a419f |
case ASN_OPAQUE_FLOAT:
|
|
|
8a419f |
vp->val.floatVal = (float *) vp->buf;
|
|
|
8a419f |
vp->val_len = sizeof(float);
|
|
|
8a419f |
- data = asn_parse_float(var_val, &len, &vp->type,
|
|
|
8a419f |
+ p = asn_parse_float(var_val, &len, &vp->type,
|
|
|
8a419f |
vp->val.floatVal, vp->val_len);
|
|
|
8a419f |
- if (!data)
|
|
|
8a419f |
+ if (!p)
|
|
|
8a419f |
return -1;
|
|
|
8a419f |
break;
|
|
|
8a419f |
case ASN_OPAQUE_DOUBLE:
|
|
|
8a419f |
vp->val.doubleVal = (double *) vp->buf;
|
|
|
8a419f |
vp->val_len = sizeof(double);
|
|
|
8a419f |
- data = asn_parse_double(var_val, &len, &vp->type,
|
|
|
8a419f |
+ p = asn_parse_double(var_val, &len, &vp->type,
|
|
|
8a419f |
vp->val.doubleVal, vp->val_len);
|
|
|
8a419f |
- if (!data)
|
|
|
8a419f |
+ if (!p)
|
|
|
8a419f |
return -1;
|
|
|
8a419f |
break;
|
|
|
8a419f |
case ASN_OPAQUE_I64:
|
|
|
8a419f |
vp->val.counter64 = (struct counter64 *) vp->buf;
|
|
|
8a419f |
vp->val_len = sizeof(struct counter64);
|
|
|
8a419f |
- data = asn_parse_signed_int64(var_val, &len, &vp->type,
|
|
|
8a419f |
+ p = asn_parse_signed_int64(var_val, &len, &vp->type,
|
|
|
8a419f |
(struct counter64 *) vp->val.counter64,
|
|
|
8a419f |
sizeof(*vp->val.counter64));
|
|
|
8a419f |
|
|
|
8a419f |
- if (!data)
|
|
|
8a419f |
+ if (!p)
|
|
|
8a419f |
return -1;
|
|
|
8a419f |
break;
|
|
|
8a419f |
#endif /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
|
|
|
8a419f |
@@ -4783,15 +4784,15 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length)
|
|
|
8a419f |
if (vp->val.string == NULL) {
|
|
|
8a419f |
return -1;
|
|
|
8a419f |
}
|
|
|
8a419f |
- data = asn_parse_string(var_val, &len, &vp->type, vp->val.string,
|
|
|
8a419f |
+ p = asn_parse_string(var_val, &len, &vp->type, vp->val.string,
|
|
|
8a419f |
&vp->val_len);
|
|
|
8a419f |
- if (!data)
|
|
|
8a419f |
+ if (!p)
|
|
|
8a419f |
return -1;
|
|
|
8a419f |
break;
|
|
|
8a419f |
case ASN_OBJECT_ID:
|
|
|
8a419f |
vp->val_len = MAX_OID_LEN;
|
|
|
8a419f |
- data = asn_parse_objid(var_val, &len, &vp->type, objid, &vp->val_len);
|
|
|
8a419f |
- if (!data)
|
|
|
8a419f |
+ p = asn_parse_objid(var_val, &len, &vp->type, objid, &vp->val_len);
|
|
|
8a419f |
+ if (!p)
|
|
|
8a419f |
return -1;
|
|
|
8a419f |
vp->val_len *= sizeof(oid);
|
|
|
8a419f |
vp->val.objid = (oid *) malloc(vp->val_len);
|
|
|
8a419f |
@@ -4810,9 +4811,9 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length)
|
|
|
8a419f |
if (vp->val.bitstring == NULL) {
|
|
|
8a419f |
return -1;
|
|
|
8a419f |
}
|
|
|
8a419f |
- data = asn_parse_bitstring(var_val, &len, &vp->type,
|
|
|
8a419f |
+ p = asn_parse_bitstring(var_val, &len, &vp->type,
|
|
|
8a419f |
vp->val.bitstring, &vp->val_len);
|
|
|
8a419f |
- if (!data)
|
|
|
8a419f |
+ if (!p)
|
|
|
8a419f |
return -1;
|
|
|
8a419f |
break;
|
|
|
8a419f |
default:
|