summaryrefslogtreecommitdiff
path: root/src/lib/libc/net/inet_ntop.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/net/inet_ntop.c')
-rw-r--r--src/lib/libc/net/inet_ntop.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/libc/net/inet_ntop.c b/src/lib/libc/net/inet_ntop.c
index 00b8f6b22e..212c0396b2 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.2 2002/02/16 21:27:23 millert Exp $ */ 1/* $OpenBSD: inet_ntop.c,v 1.3 2002/05/24 21:22:37 deraadt 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
21static char rcsid[] = "$From: inet_ntop.c,v 8.7 1996/08/05 08:41:18 vixie Exp $"; 21static char rcsid[] = "$From: inet_ntop.c,v 8.7 1996/08/05 08:41:18 vixie Exp $";
22#else 22#else
23static char rcsid[] = "$OpenBSD: inet_ntop.c,v 1.2 2002/02/16 21:27:23 millert Exp $"; 23static char rcsid[] = "$OpenBSD: inet_ntop.c,v 1.3 2002/05/24 21:22:37 deraadt Exp $";
24#endif 24#endif
25#endif /* LIBC_SCCS and not lint */ 25#endif /* LIBC_SCCS and not lint */
26 26
@@ -89,11 +89,11 @@ inet_ntop4(src, dst, size)
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 91
92 if (sprintf(tmp, fmt, src[0], src[1], src[2], src[3]) > size) { 92 if (snprintf(tmp, size, fmt, src[0], src[1], src[2], src[3]) >= size) {
93 errno = ENOSPC; 93 errno = ENOSPC;
94 return (NULL); 94 return (NULL);
95 } 95 }
96 strcpy(dst, tmp); 96 strlcpy(dst, tmp, size);
97 return (dst); 97 return (dst);
98} 98}
99 99
@@ -189,6 +189,6 @@ inet_ntop6(src, dst, size)
189 errno = ENOSPC; 189 errno = ENOSPC;
190 return (NULL); 190 return (NULL);
191 } 191 }
192 strcpy(dst, tmp); 192 strlcpy(dst, tmp, size);
193 return (dst); 193 return (dst);
194} 194}