K 10 svn:author V 4 ngie K 8 svn:date V 27 2016-05-24T04:23:58.607579Z K 7 svn:log V 2016 MFC r299764,r299765,r299767,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. r299767: Mute sign compare warning by casting rc to u_int to match nbindings' type rc cannot be negative -- that was already tested for earlier on in the function 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 END