summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2014-05-20 09:16:43 +0000
committermpi <mpi@openbsd.org>2014-05-20 09:16:43 +0000
commit338e5e412463fb59a6d13c784a75afa8c109f747 (patch)
treeacea9dec7c149edb22318938f9db97c93fd2507b
parentremove dead files (diff)
downloadwireguard-openbsd-338e5e412463fb59a6d13c784a75afa8c109f747.tar.xz
wireguard-openbsd-338e5e412463fb59a6d13c784a75afa8c109f747.zip
correctly match size and buffer. from enh at google
-rw-r--r--sys/netinet/inet_ntop.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/netinet/inet_ntop.c b/sys/netinet/inet_ntop.c
index 6a7944af579..809a7cfdc39 100644
--- a/sys/netinet/inet_ntop.c
+++ b/sys/netinet/inet_ntop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inet_ntop.c,v 1.1 2013/11/11 09:15:34 mpi Exp $ */
+/* $OpenBSD: inet_ntop.c,v 1.2 2014/05/20 09:16:43 mpi Exp $ */
/* Copyright (c) 1996 by Internet Software Consortium.
*
@@ -74,11 +74,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) {
return (NULL);
}