Fix a bug in decoding string indexes in snmp_target(3), thus causing
bsnmpd(1) to not send v3 notifications properly; while here add two missing return statements which could lead to abort() in case of a rollback
This commit is contained in:
parent
ddd96d231d
commit
ac89bc4f84
@ -301,6 +301,7 @@ op_snmp_target_addrs(struct snmp_context *ctx __unused, struct snmp_value *val,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return (SNMP_ERR_NOERROR);
|
||||
|
||||
default:
|
||||
abort();
|
||||
@ -625,6 +626,7 @@ op_snmp_notify(struct snmp_context *ctx __unused, struct snmp_value *val,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return (SNMP_ERR_NOERROR);
|
||||
|
||||
default:
|
||||
abort();
|
||||
@ -663,13 +665,14 @@ target_append_index(struct asn_oid *oid, uint sub, const char *name)
|
||||
static int
|
||||
target_decode_index(const struct asn_oid *oid, uint sub, char *name)
|
||||
{
|
||||
uint32_t i, len;
|
||||
uint32_t i;
|
||||
|
||||
if ((len = oid->len - sub) >= SNMP_ADM_STR32_SIZ)
|
||||
if (oid->len - sub != oid->subs[sub] + 1 || oid->subs[sub] >=
|
||||
SNMP_ADM_STR32_SIZ)
|
||||
return (-1);
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
name[i] = oid->subs[sub + i];
|
||||
for (i = 0; i < oid->subs[sub]; i++)
|
||||
name[i] = oid->subs[sub + i + 1];
|
||||
name[i] = '\0';
|
||||
|
||||
return (0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user