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