summaryrefslogtreecommitdiff
path: root/usr.sbin/bind/lib/lwres/lwinetntop.c
diff options
context:
space:
mode:
authorMoritz Jodeit <moritz@cvs.openbsd.org>2005-04-19 17:15:54 +0000
committerMoritz Jodeit <moritz@cvs.openbsd.org>2005-04-19 17:15:54 +0000
commitf58a9436f2c5c263a756964e7391dc167b8210c0 (patch)
tree3e9cbc6bed3078b06f71b059fbadf4d9df98287b /usr.sbin/bind/lib/lwres/lwinetntop.c
parentbba2b6205529743303c55f5e552e55f29c13b5f7 (diff)
fix more cases of snprintf() returning -1. ok cloder@ niallo@
Diffstat (limited to 'usr.sbin/bind/lib/lwres/lwinetntop.c')
-rw-r--r--usr.sbin/bind/lib/lwres/lwinetntop.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/bind/lib/lwres/lwinetntop.c b/usr.sbin/bind/lib/lwres/lwinetntop.c
index 1d02defdf9a..311c5837ed9 100644
--- a/usr.sbin/bind/lib/lwres/lwinetntop.c
+++ b/usr.sbin/bind/lib/lwres/lwinetntop.c
@@ -84,10 +84,12 @@ static const char *
inet_ntop4(const unsigned char *src, char *dst, size_t size) {
static const char fmt[] = "%u.%u.%u.%u";
char tmp[sizeof("255.255.255.255")];
- size_t len;
+ int len;
len = snprintf(tmp, sizeof(tmp), fmt, src[0], src[1], src[2], src[3]);
- if (len >= size) {
+ if (len == -1)
+ return (NULL);
+ if ((size_t)len >= size) {
errno = ENOSPC;
return (NULL);
}