From 60c2226f895537ddb9b0d632b6e77f7518ad69f6 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Thu, 5 Jan 2017 09:46:36 +0000 Subject: [PATCH] op_usm_users: don't deref uusers if it's NULL when SETting the value Add an XXX comment to note that the conditional seems suspect given how it's handled elsewhere in the SNMP_OP_SET case. MFC after: 2 weeks Reported by: Coverity CID: 1008573 --- contrib/bsnmp/snmp_usm/usm_snmp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/contrib/bsnmp/snmp_usm/usm_snmp.c b/contrib/bsnmp/snmp_usm/usm_snmp.c index 6ed639af8c73..a6c7b8634a1b 100644 --- a/contrib/bsnmp/snmp_usm/usm_snmp.c +++ b/contrib/bsnmp/snmp_usm/usm_snmp.c @@ -169,8 +169,12 @@ op_usm_users(struct snmp_context *ctx, struct snmp_value *val, val->var.subs[sub - 1] != LEAF_usmUserCloneFrom) return (SNMP_ERR_NOSUCHNAME); + /* + * XXX (ngie): need to investigate the MIB to determine how + * this is possible given some of the transitions below. + */ if (community != COMM_INITIALIZE && - uuser->type == StorageType_readOnly) + uuser != NULL && uuser->type == StorageType_readOnly) return (SNMP_ERR_NOT_WRITEABLE); switch (val->var.subs[sub - 1]) {