summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2014-05-20 09:16:44 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2014-05-20 09:16:44 +0000
commit06769922fecc8d906fd23951155bd73d4ef746a4 (patch)
tree60ab919ac6136658426e0ce5d1f92f1401f31067
parent7eeebd0ccdf5385ed2e2489c15becf6ad844f5a8 (diff)
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);
}