]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
snmp_output_err_resp, snmp_output_resp: allocate `object` using calloc, not
authorngie <ngie@FreeBSD.org>
Sat, 31 Dec 2016 22:46:17 +0000 (22:46 +0000)
committerngie <ngie@FreeBSD.org>
Sat, 31 Dec 2016 22:46:17 +0000 (22:46 +0000)
commit20e01106241d83a81ee7b21e7b30d738e8df0594
tree08835426c9a6ac1220d7326ff865d870ce00cf84
parent1f505979e604b178d5c7c6850a078b8a819809ed
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

MFC after: 1 week
Reported by: Coverity
CID: 1006392
usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c