]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC r310954,r310987,r311222:
authorngie <ngie@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sat, 7 Jan 2017 08:28:41 +0000 (08:28 +0000)
committerngie <ngie@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sat, 7 Jan 2017 08:28:41 +0000 (08:28 +0000)
commitbea788a31f8a11026e3a8256267a2f9574487c16
tree153bd56a640f967060b3a28e2fdcdda9ef89596c
parent98d5ee5463a651d894eaea6e2a7e3250fde8541e
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

git-svn-id: svn://svn.freebsd.org/base/stable/10@311590 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c
usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c