Also: from me: fix an "off by 1" issue in inet_ntop_4
which could result in a trailing character of the
output string being truncated rather than an ENOSPC
error being reported.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@27766
f5534014-38df-0310-8fa8-
9805f1628bb7
int nprinted;
nprinted = g_snprintf(tmp, sizeof(tmp), fmt, src[0], src[1], src[2], src[3]);
- if (nprinted < 0)
- return (NULL); /* we assume "errno" was set by "g_snprintf()" */
- if ((size_t)nprinted > size) {
+ /* Note: nprinted *excludes* the trailing '\0' character */
+ if ((size_t)nprinted >= size) {
errno = ENOSPC;
return (NULL);
}