diff options
Diffstat (limited to 'src/lib/libc')
| -rw-r--r-- | src/lib/libc/net/inet_ntop.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/libc/net/inet_ntop.c b/src/lib/libc/net/inet_ntop.c index 5293e80fc0..adce61c1d4 100644 --- a/src/lib/libc/net/inet_ntop.c +++ b/src/lib/libc/net/inet_ntop.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: inet_ntop.c,v 1.4 2002/08/19 03:01:54 itojun Exp $ */ | 1 | /* $OpenBSD: inet_ntop.c,v 1.5 2002/08/23 16:27:31 itojun Exp $ */ |
| 2 | 2 | ||
| 3 | /* Copyright (c) 1996 by Internet Software Consortium. | 3 | /* Copyright (c) 1996 by Internet Software Consortium. |
| 4 | * | 4 | * |
| @@ -20,7 +20,7 @@ | |||
| 20 | #if 0 | 20 | #if 0 |
| 21 | static char rcsid[] = "$From: inet_ntop.c,v 8.7 1996/08/05 08:41:18 vixie Exp $"; | 21 | static char rcsid[] = "$From: inet_ntop.c,v 8.7 1996/08/05 08:41:18 vixie Exp $"; |
| 22 | #else | 22 | #else |
| 23 | static char rcsid[] = "$OpenBSD: inet_ntop.c,v 1.4 2002/08/19 03:01:54 itojun Exp $"; | 23 | static char rcsid[] = "$OpenBSD: inet_ntop.c,v 1.5 2002/08/23 16:27:31 itojun Exp $"; |
| 24 | #endif | 24 | #endif |
| 25 | #endif /* LIBC_SCCS and not lint */ | 25 | #endif /* LIBC_SCCS and not lint */ |
| 26 | 26 | ||
| @@ -88,8 +88,10 @@ inet_ntop4(src, dst, size) | |||
| 88 | { | 88 | { |
| 89 | static const char fmt[] = "%u.%u.%u.%u"; | 89 | static const char fmt[] = "%u.%u.%u.%u"; |
| 90 | char tmp[sizeof "255.255.255.255"]; | 90 | char tmp[sizeof "255.255.255.255"]; |
| 91 | int l; | ||
| 91 | 92 | ||
| 92 | if (snprintf(tmp, size, fmt, src[0], src[1], src[2], src[3]) >= size) { | 93 | l = snprintf(tmp, size, fmt, src[0], src[1], src[2], src[3]); |
| 94 | if (l <= 0 || l >= size) { | ||
| 93 | errno = ENOSPC; | 95 | errno = ENOSPC; |
| 94 | return (NULL); | 96 | return (NULL); |
| 95 | } | 97 | } |
