Fix theoretical buffer overflow issues in snmp_oid2asn_oid
authorngie <ngie@FreeBSD.org>
Sat, 14 May 2016 21:32:52 +0000 (21:32 +0000)
committerngie <ngie@FreeBSD.org>
Sat, 14 May 2016 21:32:52 +0000 (21:32 +0000)
commitd20d003d02db33d439cc7ec7d18bd8b473e62e7f
tree1c2baf36561d0723da599947be09ec97e1c70d17
parentfc842bcc02dea1dc7fe1b1ec158cf816d7adf25b
Fix theoretical buffer overflow issues in snmp_oid2asn_oid

Increase the size of `string` by 1 to account for the '\0' terminator. In the event
that `str` doesn't contain any non-alpha chars, i would be set to MAXSTR, and
the subsequent strlcpy call would overflow by a character.

Remove unnecessary `string[i] = '\0'` -- this is already handled by strlcpy.

MFC after: 1 week
Reported by: clang
Sponsored by: EMC / Isilon Storage Division
usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c