From 37f02b1da57eb6807e849a5056bf973db840dd78 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 30 Apr 2007 22:30:14 +0000 Subject: [BZ #4439] 2007-04-30 Jakub Jelinek [BZ #4439] * resolv/inet_ntop.c (inet_ntop4): Take terminating '\0' into account in the size check. * resolv/tst-inet_ntop.c: New test. * resolv/Makefile (tests): Add tst-inet_ntop. --- resolv/inet_ntop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'resolv/inet_ntop.c') diff --git a/resolv/inet_ntop.c b/resolv/inet_ntop.c index e5553a1d3b..1222d08bda 100644 --- a/resolv/inet_ntop.c +++ b/resolv/inet_ntop.c @@ -96,7 +96,7 @@ inet_ntop4(src, dst, size) static const char fmt[] = "%u.%u.%u.%u"; char tmp[sizeof "255.255.255.255"]; - if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) > size) { + if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) >= size) { __set_errno (ENOSPC); return (NULL); } -- cgit 1.4.1