HomeFreeBSD

MFC r310954,r310987,r311222:

Description

MFC r310954,r310987,r311222:

r310954:

Set value->v.octetstring.len to a correct value on malloc success/failure

The previous code always set value->v.octetstring.len to len, regardless
of the result from the malloc call. This misleads the caller on malloc
failure. Set .len to len on success and 0 on failure.

CID: 1007590

r310987:

snmp_output_err_resp, snmp_output_resp: allocate object using calloc, not
on the stack

Some of the callers try to determine whether or not object is valid by
testing the value for NULL, which will never be true if it's a stack value,
so in order to be clear and correct down the call stack, use a heap
allocated object.

This also addresses a Coverity issue by initializing all of object via
calloc

CID: 1006392

r311222:

Fix logical inversion when checking result from calloc
in snmp_output_err_resp(..)

CID: 1368195

Details

Provenance
ngieAuthored on
Parents
rS311590: MFC r310954,r310987,r311222:
Branches
Unknown
Tags
Unknown