summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2014-05-17 18:16:14 +0000
committertedu <tedu@openbsd.org>2014-05-17 18:16:14 +0000
commit48772bb85ecdc0bc96611eb9ac7d16a208fb2716 (patch)
tree15d01866cfafb14daa4248fa523da34e446a15bb /lib/libc
parentsimple reallocarray to check multiplies. ok guenther (diff)
downloadwireguard-openbsd-48772bb85ecdc0bc96611eb9ac7d16a208fb2716.tar.xz
wireguard-openbsd-48772bb85ecdc0bc96611eb9ac7d16a208fb2716.zip
correctly match size and buffer. from enh at google
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/net/inet_ntop.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/net/inet_ntop.c b/lib/libc/net/inet_ntop.c
index 359acd8cda4..f991a071bab 100644
--- a/lib/libc/net/inet_ntop.c
+++ b/lib/libc/net/inet_ntop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inet_ntop.c,v 1.9 2014/02/05 14:20:43 millert Exp $ */
+/* $OpenBSD: inet_ntop.c,v 1.10 2014/05/17 18:16:14 tedu Exp $ */
/* Copyright (c) 1996 by Internet Software Consortium.
*
@@ -71,11 +71,11 @@ inet_ntop(int af, const void *src, char *dst, socklen_t size)
static const char *
inet_ntop4(const u_char *src, char *dst, size_t size)
{
- static const char fmt[] = "%u.%u.%u.%u";
char tmp[sizeof "255.255.255.255"];
int l;
- l = snprintf(tmp, size, fmt, src[0], src[1], src[2], src[3]);
+ l = snprintf(tmp, sizeof(tmp), "%u.%u.%u.%u",
+ src[0], src[1], src[2], src[3]);
if (l <= 0 || l >= size) {
errno = ENOSPC;
return (NULL);