]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/commit
MFC r299764,r299765,r299769,r299770,r299774,r299802,r299803,r299805,r299814:
authorngie <ngie@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Tue, 24 May 2016 04:34:45 +0000 (04:34 +0000)
committerngie <ngie@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Tue, 24 May 2016 04:34:45 +0000 (04:34 +0000)
commit1d3a2544f06a20dd5c56520bd6bb9fe62e87d19f
tree21737c6399f81b3598da4e279977939d898687cf
parent961be2596b6e5dca95de137b8794f901f14aee1c
MFC r299764,r299765,r299769,r299770,r299774,r299802,r299803,r299805,r299814:

r299764:

Use the size of the destination buffer, not the source buffer.

Technically this is a no-op, but mute the clang warning in case the malloc call
above for fstring ever changes in the future

r299765:

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.

r299769:

Use the size of the destination buffer instead of the malloc size, repeated, in order
to mute a -Wstrlcpy-strlcat-size warning

r299770:

Fix up r299764

I meant to use nitems, not sizeof(..) with the destination buffer. Using sizeof(..)
on a pointer will always truncate the output in the destination buffer incorrectly

Pointyhat to: ngie

r299774:

Do minimal work necessary to cure a -Wunused-but-set-variable warning from gcc

How errno is saved before and restored after strtoul calls needs a rethink

r299802:

Fix up both r299764 and r299770

nitems was wrong too, as it was being tested against a pointer instead of a buffer on
the stack.

Since the old code was just doing malloc, then strlcpy'ing the contents of the source
buffer into the destination buffer, replace it all with a call to strdup..

Supersized Duncecap to: ngie

r299803:

Replace malloc + memset(.., 0, ..) with calloc calls

r299805:

Fix up r299769

Similar to r299802, it was noted that using nitems on scalar pointers is
invalid.

Use strdup instead of malloc + strlcpy (which is what the old code was doing
anyhow).

Pointyhat to: ngie

r299814:

Replace malloc + memset(.., 0, ..) with calloc calls

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