Prevent improper memory accesses after calling snmp_pdu_free and snmp_value_free
authorngie <ngie@FreeBSD.org>
Thu, 29 Dec 2016 00:20:03 +0000 (00:20 +0000)
committerngie <ngie@FreeBSD.org>
Thu, 29 Dec 2016 00:20:03 +0000 (00:20 +0000)
commit4093156173132fa20a07ae574a2a20a9134f619d
treee1e95d42174011b193a613d1974cd865ab22aa0b
parentf3b7ca776a61262f06b62eec23c42b33e4a61a92
Prevent improper memory accesses after calling snmp_pdu_free and snmp_value_free

snmp_pdu_free: set pdu->nbindings to 0 to limit the damage that
could happen if a pdu was reused after calling the function, and
as both stack and heap allocation types are used in contrib/bsnmp
and usr.sbin/bsnmpd.

snmp_value_free: NULL out value->v.octetstring.octets after calling
free on it to prevent a double-free from occurring.

MFC after:      2 weeks
contrib/bsnmp/lib/snmp.c