From 338e5e412463fb59a6d13c784a75afa8c109f747 Mon Sep 17 00:00:00 2001 From: mpi Date: Tue, 20 May 2014 09:16:43 +0000 Subject: [PATCH] correctly match size and buffer. from enh at google --- sys/netinet/inet_ntop.c | 6 +++--- 1 file 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); } -- 2.20.1