Module Name:    src
Committed By:   christos
Date:           Thu Mar 20 20:43:12 UTC 2014

Modified Files:
        src/sys/external/bsd/ipf/netinet: fil.c ip_compat.h ip_fil_compat.c
            ip_ftp_pxy.c ip_htable.c ip_irc_pxy.c ip_lookup.c ip_pool.c
            ip_rpcb_pxy.c radix_ipf.c

Log Message:
kill sprintf


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/external/bsd/ipf/netinet/fil.c
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/ipf/netinet/ip_compat.h
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/ipf/netinet/ip_fil_compat.c \
    src/sys/external/bsd/ipf/netinet/ip_irc_pxy.c \
    src/sys/external/bsd/ipf/netinet/ip_lookup.c \
    src/sys/external/bsd/ipf/netinet/ip_pool.c \
    src/sys/external/bsd/ipf/netinet/ip_rpcb_pxy.c
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/ipf/netinet/ip_ftp_pxy.c \
    src/sys/external/bsd/ipf/netinet/radix_ipf.c
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/ipf/netinet/ip_htable.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/ipf/netinet/fil.c
diff -u src/sys/external/bsd/ipf/netinet/fil.c:1.13 src/sys/external/bsd/ipf/netinet/fil.c:1.14
--- src/sys/external/bsd/ipf/netinet/fil.c:1.13	Wed Nov 27 17:18:06 2013
+++ src/sys/external/bsd/ipf/netinet/fil.c	Thu Mar 20 16:43:12 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: fil.c,v 1.13 2013/11/27 22:18:06 christos Exp $	*/
+/*	$NetBSD: fil.c,v 1.14 2014/03/20 20:43:12 christos Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -138,7 +138,7 @@ extern struct timeout ipf_slowtimer_ch;
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.13 2013/11/27 22:18:06 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.14 2014/03/20 20:43:12 christos Exp $");
 #else
 static const char sccsid[] = "@(#)fil.c	1.36 6/5/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: fil.c,v 1.1.1.2 2012/07/22 13:45:07 darrenr Exp $";
@@ -4196,14 +4196,14 @@ ipf_getstat(ipf_main_softc_t *softc, fri
 	fiop->f_features = ipf_features;
 
 #ifdef IPFILTER_COMPAT
-	sprintf(fiop->f_version, "IP Filter: v%d.%d.%d",
-		(rev / 1000000) % 100,
-		(rev / 10000) % 100,
-		(rev / 100) % 100);
+	snprintf(fiop->f_version, sizeof(fiop->f_version),
+		 "IP Filter: v%d.%d.%d", (rev / 1000000) % 100,
+		 (rev / 10000) % 100, (rev / 100) % 100);
 #else
 	rev = rev;
 	(void) strncpy(fiop->f_version, ipfilter_version,
 		       sizeof(fiop->f_version));
+        fiop->f_version[sizeof(fiop->f_version) - 1] = '\0';
 #endif
 }
 
@@ -5392,11 +5392,7 @@ ipf_grpmapinit(ipf_main_softc_t *softc, 
 	char name[FR_GROUPLEN];
 	iphtable_t *iph;
 
-#if defined(SNPRINTF) && defined(_KERNEL)
-	SNPRINTF(name, sizeof(name), "%d", fr->fr_arg);
-#else
-	(void) sprintf(name, "%d", fr->fr_arg);
-#endif
+	(void) snprintf(name, sizeof(name), "%d", fr->fr_arg);
 	iph = ipf_lookup_find_htable(softc, IPL_LOGIPF, name);
 	if (iph == NULL) {
 		IPFERROR(38);
@@ -5932,12 +5928,9 @@ ipf_getifname(ifp, buffer)
 	unit = ifp->if_unit;
 	space = LIFNAMSIZ - (s - buffer);
 	if ((space > 0) && (unit >= 0)) {
-#  if defined(SNPRINTF) && defined(_KERNEL)
-		SNPRINTF(temp, sizeof(temp), "%d", unit);
-#  else
-		(void) sprintf(temp, "%d", unit);
-#  endif
+		snprintf(temp, sizeof(temp), "%d", unit);
 		(void) strncpy(s, temp, space);
+		s[space - 1] = '\0';
 	}
 # endif
 	return buffer;

Index: src/sys/external/bsd/ipf/netinet/ip_compat.h
diff -u src/sys/external/bsd/ipf/netinet/ip_compat.h:1.6 src/sys/external/bsd/ipf/netinet/ip_compat.h:1.7
--- src/sys/external/bsd/ipf/netinet/ip_compat.h:1.6	Wed Jan  9 08:23:20 2013
+++ src/sys/external/bsd/ipf/netinet/ip_compat.h	Thu Mar 20 16:43:12 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_compat.h,v 1.6 2013/01/09 13:23:20 christos Exp $	*/
+/*	$NetBSD: ip_compat.h,v 1.7 2014/03/20 20:43:12 christos Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -235,7 +235,6 @@ struct file;
 #  include <inet/ip_ire.h>
 # endif
 # if SOLARIS2 >= 8
-#  define SNPRINTF	snprintf
 
 #  include <inet/ip_if.h>
 #  define	ipif_local_addr	ipif_lcl_addr
@@ -431,7 +430,6 @@ typedef	struct	ip6_hdr	ip6_t;
 
 # ifdef _KERNEL
 #  define	FASTROUTE_RECURSION	1
-#  define SNPRINTF	sprintf
 #  if (HPUXREV >= 1111)
 #   define	IPL_SELECT
 #   ifdef	IPL_SELECT
@@ -1173,7 +1171,6 @@ typedef	u_int32_t	u_32_t;
 #   include "bpfilter.h"
 #  endif
 #  if (OpenBSD >= 200311)
-#   define SNPRINTF	snprintf
 #   if defined(USE_INET6)
 #    include "netinet6/in6_var.h"
 #    include "netinet6/nd6.h"

Index: src/sys/external/bsd/ipf/netinet/ip_fil_compat.c
diff -u src/sys/external/bsd/ipf/netinet/ip_fil_compat.c:1.3 src/sys/external/bsd/ipf/netinet/ip_fil_compat.c:1.4
--- src/sys/external/bsd/ipf/netinet/ip_fil_compat.c:1.3	Sun Jul 22 10:27:51 2012
+++ src/sys/external/bsd/ipf/netinet/ip_fil_compat.c	Thu Mar 20 16:43:12 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_fil_compat.c,v 1.3 2012/07/22 14:27:51 darrenr Exp $	*/
+/*	$NetBSD: ip_fil_compat.c,v 1.4 2014/03/20 20:43:12 christos Exp $	*/
 
 /*
  * Copyright (C) 2002-2012 by Darren Reed.
@@ -3526,10 +3526,8 @@ friostat_current_to_4_1_33(void *current
 	old->f_running = fiop->f_running;
 	old->f_logging = fiop->f_logging;
 	old->f_features = fiop->f_features;
-	sprintf(old->f_version, "IP Filter: v%d.%d.%d",
-		(rev / 1000000) % 100,
-		(rev / 10000) % 100,
-		(rev / 100) % 100);
+	snprintf(old->f_version, sizeof(old->f_version), "IP Filter: v%d.%d.%d",
+		(rev / 1000000) % 100, (rev / 10000) % 100, (rev / 100) % 100);
 }
 
 
@@ -3589,10 +3587,8 @@ friostat_current_to_4_1_0(void *current,
 	old->f_running = fiop->f_running;
 	old->f_logging = fiop->f_logging;
 	old->f_features = fiop->f_features;
-	sprintf(old->f_version, "IP Filter: v%d.%d.%d",
-		(rev / 1000000) % 100,
-		(rev / 10000) % 100,
-		(rev / 100) % 100);
+	snprintf(old->f_version, sizeof(old->f_version), "IP Filter: v%d.%d.%d",
+		(rev / 1000000) % 100, (rev / 10000) % 100, (rev / 100) % 100);
 }
 
 
Index: src/sys/external/bsd/ipf/netinet/ip_irc_pxy.c
diff -u src/sys/external/bsd/ipf/netinet/ip_irc_pxy.c:1.3 src/sys/external/bsd/ipf/netinet/ip_irc_pxy.c:1.4
--- src/sys/external/bsd/ipf/netinet/ip_irc_pxy.c:1.3	Sun Jul 22 10:27:51 2012
+++ src/sys/external/bsd/ipf/netinet/ip_irc_pxy.c	Thu Mar 20 16:43:12 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_irc_pxy.c,v 1.3 2012/07/22 14:27:51 darrenr Exp $	*/
+/*	$NetBSD: ip_irc_pxy.c,v 1.4 2014/03/20 20:43:12 christos Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -9,7 +9,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: ip_irc_pxy.c,v 1.3 2012/07/22 14:27:51 darrenr Exp $");
+__KERNEL_RCSID(1, "$NetBSD: ip_irc_pxy.c,v 1.4 2014/03/20 20:43:12 christos Exp $");
 
 #define	IPF_IRC_PROXY
 
@@ -309,12 +309,7 @@ ipf_p_irc_send(fr_info_t *fin, nat_t *na
 	i = irc->irc_addr - ctcpbuf;
 	i++;
 	(void) strncpy(newbuf, ctcpbuf, i);
-	/* DO NOT change these! */
-#if defined(SNPRINTF) && defined(KERNEL)
-	SNPRINTF(newbuf, sizeof(newbuf) - i, "%u %u\001\r\n", a1, a5);
-#else
-	(void) sprintf(newbuf, "%u %u\001\r\n", a1, a5);
-#endif
+	snprintf(newbuf, sizeof(newbuf) - i, "%u %u\001\r\n", a1, a5);
 
 	nlen = strlen(newbuf);
 	inc = nlen - olen;
Index: src/sys/external/bsd/ipf/netinet/ip_lookup.c
diff -u src/sys/external/bsd/ipf/netinet/ip_lookup.c:1.3 src/sys/external/bsd/ipf/netinet/ip_lookup.c:1.4
--- src/sys/external/bsd/ipf/netinet/ip_lookup.c:1.3	Sun Jul 22 10:27:51 2012
+++ src/sys/external/bsd/ipf/netinet/ip_lookup.c	Thu Mar 20 16:43:12 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_lookup.c,v 1.3 2012/07/22 14:27:51 darrenr Exp $	*/
+/*	$NetBSD: ip_lookup.c,v 1.4 2014/03/20 20:43:12 christos Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -68,7 +68,7 @@ struct file;
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_lookup.c,v 1.3 2012/07/22 14:27:51 darrenr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_lookup.c,v 1.4 2014/03/20 20:43:12 christos Exp $");
 #else
 static const char rcsid[] = "@(#)Id: ip_lookup.c,v 1.1.1.2 2012/07/22 13:45:21 darrenr Exp";
 #endif
@@ -818,11 +818,7 @@ ipf_lookup_res_num(ipf_main_softc_t *sof
 {
 	char name[FR_GROUPLEN];
 
-#if defined(SNPRINTF) && defined(_KERNEL)
-	SNPRINTF(name, sizeof(name), "%u", number);
-#else
-	(void) sprintf(name, "%u", number);
-#endif
+	snprintf(name, sizeof(name), "%u", number);
 
 	return ipf_lookup_res_name(softc, unit, type, name, funcptr);
 }
Index: src/sys/external/bsd/ipf/netinet/ip_pool.c
diff -u src/sys/external/bsd/ipf/netinet/ip_pool.c:1.3 src/sys/external/bsd/ipf/netinet/ip_pool.c:1.4
--- src/sys/external/bsd/ipf/netinet/ip_pool.c:1.3	Sun Jul 22 10:27:51 2012
+++ src/sys/external/bsd/ipf/netinet/ip_pool.c	Thu Mar 20 16:43:12 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_pool.c,v 1.3 2012/07/22 14:27:51 darrenr Exp $	*/
+/*	$NetBSD: ip_pool.c,v 1.4 2014/03/20 20:43:12 christos Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -72,7 +72,7 @@ struct file;
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_pool.c,v 1.3 2012/07/22 14:27:51 darrenr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_pool.c,v 1.4 2014/03/20 20:43:12 christos Exp $");
 #else
 static const char sccsid[] = "@(#)ip_fil.c	2.41 6/5/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: ip_pool.c,v 1.1.1.2 2012/07/22 13:45:31 darrenr Exp";
@@ -955,21 +955,13 @@ ipf_pool_create(ipf_main_softc_t *softc,
 		h->ipo_flags |= IPOOL_ANON;
 		poolnum = LOOKUP_ANON;
 
-#if defined(SNPRINTF) && defined(_KERNEL)
-		SNPRINTF(name, sizeof(name), "%x", poolnum);
-#else
-		(void)sprintf(name, "%x", poolnum);
-#endif
+		snprintf(name, sizeof(name), "%x", poolnum);
 
 		for (p = softp->ipf_pool_list[unit + 1]; p != NULL; ) {
 			if (strncmp(name, p->ipo_name,
 				    sizeof(p->ipo_name)) == 0) {
 				poolnum++;
-#if defined(SNPRINTF) && defined(_KERNEL)
-				SNPRINTF(name, sizeof(name), "%x", poolnum);
-#else
-				(void)sprintf(name, "%x", poolnum);
-#endif
+				snprintf(name, sizeof(name), "%x", poolnum);
 				p = softp->ipf_pool_list[unit + 1];
 			} else
 				p = p->ipo_next;
Index: src/sys/external/bsd/ipf/netinet/ip_rpcb_pxy.c
diff -u src/sys/external/bsd/ipf/netinet/ip_rpcb_pxy.c:1.3 src/sys/external/bsd/ipf/netinet/ip_rpcb_pxy.c:1.4
--- src/sys/external/bsd/ipf/netinet/ip_rpcb_pxy.c:1.3	Sun Jul 22 10:27:51 2012
+++ src/sys/external/bsd/ipf/netinet/ip_rpcb_pxy.c	Thu Mar 20 16:43:12 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_rpcb_pxy.c,v 1.3 2012/07/22 14:27:51 darrenr Exp $	*/
+/*	$NetBSD: ip_rpcb_pxy.c,v 1.4 2014/03/20 20:43:12 christos Exp $	*/
 
 /*
  * Copyright (C) 2002-2012 by Ryan Beasley <ry...@goddamnbastard.org>
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: ip_rpcb_pxy.c,v 1.3 2012/07/22 14:27:51 darrenr Exp $");
+__KERNEL_RCSID(1, "$NetBSD: ip_rpcb_pxy.c,v 1.4 2014/03/20 20:43:12 christos Exp $");
 
 #define	IPF_RPCB_PROXY
 
@@ -760,15 +760,9 @@ ipf_p_rpcb_modreq(fr_info_t *fin, nat_t 
 
 	/* Form new string. */
 	bzero(uaddr, sizeof(uaddr)); /* Just in case we need padding. */
-#if defined(SNPRINTF) && defined(_KERNEL)
-	SNPRINTF(uaddr, sizeof(uaddr),
+	snprintf(uaddr, sizeof(uaddr),
 		       "%u.%u.%u.%u.%u.%u", i[0] & 0xff, i[1] & 0xff,
 		       i[2] & 0xff, i[3] & 0xff, p[0] & 0xff, p[1] & 0xff);
-#else
-	(void) sprintf(uaddr,
-		       "%u.%u.%u.%u.%u.%u", i[0] & 0xff, i[1] & 0xff,
-		       i[2] & 0xff, i[3] & 0xff, p[0] & 0xff, p[1] & 0xff);
-#endif
 	len = strlen(uaddr);
 	xlen = XDRALIGN(len);
 
@@ -1279,15 +1273,9 @@ ipf_p_rpcb_modv3(fr_info_t *fin, nat_t *
 
 	/* Form new string. */
 	bzero(uaddr, sizeof(uaddr)); /* Just in case we need padding. */
-#if defined(SNPRINTF) && defined(_KERNEL)
-	SNPRINTF(uaddr, sizeof(uaddr),
-		       "%u.%u.%u.%u.%u.%u", i[0] & 0xff, i[1] & 0xff,
-		       i[2] & 0xff, i[3] & 0xff, p[0] & 0xff, p[1] & 0xff);
-#else
-	(void) sprintf(uaddr,
+	snprintf(uaddr, sizeof(uaddr),
 		       "%u.%u.%u.%u.%u.%u", i[0] & 0xff, i[1] & 0xff,
 		       i[2] & 0xff, i[3] & 0xff, p[0] & 0xff, p[1] & 0xff);
-#endif
 	len = strlen(uaddr);
 	xlen = XDRALIGN(len);
 
@@ -1356,17 +1344,10 @@ ipf_p_rpcb_modv4(fr_info_t *fin, nat_t *
 		/* Form new string. */
 		bzero(uaddr, sizeof(uaddr)); /* Just in case we need
 						padding. */
-#if defined(SNPRINTF) && defined(_KERNEL)
-		SNPRINTF(uaddr, sizeof(uaddr),
+		snprintf(uaddr, sizeof(uaddr),
 			       "%u.%u.%u.%u.%u.%u", i[0] & 0xff,
 			       i[1] & 0xff, i[2] & 0xff, i[3] & 0xff,
 			       p[0] & 0xff, p[1] & 0xff);
-#else
-		(void) sprintf(uaddr,
-			       "%u.%u.%u.%u.%u.%u", i[0] & 0xff,
-			       i[1] & 0xff, i[2] & 0xff, i[3] & 0xff,
-			       p[0] & 0xff, p[1] & 0xff);
-#endif
 		len = strlen(uaddr);
 		xlen = XDRALIGN(len);
 

Index: src/sys/external/bsd/ipf/netinet/ip_ftp_pxy.c
diff -u src/sys/external/bsd/ipf/netinet/ip_ftp_pxy.c:1.4 src/sys/external/bsd/ipf/netinet/ip_ftp_pxy.c:1.5
--- src/sys/external/bsd/ipf/netinet/ip_ftp_pxy.c:1.4	Mon Jul 30 15:27:46 2012
+++ src/sys/external/bsd/ipf/netinet/ip_ftp_pxy.c	Thu Mar 20 16:43:12 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_ftp_pxy.c,v 1.4 2012/07/30 19:27:46 pgoyette Exp $	*/
+/*	$NetBSD: ip_ftp_pxy.c,v 1.5 2014/03/20 20:43:12 christos Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -12,7 +12,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: ip_ftp_pxy.c,v 1.4 2012/07/30 19:27:46 pgoyette Exp $");
+__KERNEL_RCSID(1, "$NetBSD: ip_ftp_pxy.c,v 1.5 2014/03/20 20:43:12 christos Exp $");
 
 #define	IPF_FTP_PROXY
 
@@ -391,14 +391,8 @@ ipf_p_ftp_port(ipf_ftp_softc_t *softf, f
 	a4 = a1 & 0xff;
 	a1 >>= 24;
 	olen = s - f->ftps_rptr;
-	/* DO NOT change this to snprintf! */
-#if defined(SNPRINTF) && defined(_KERNEL)
-	SNPRINTF(newbuf, sizeof(newbuf), "%s %u,%u,%u,%u,%u,%u\r\n",
+	snprintf(newbuf, sizeof(newbuf), "%s %u,%u,%u,%u,%u,%u\r\n",
 		 "PORT", a1, a2, a3, a4, a5, a6);
-#else
-	(void) sprintf(newbuf, "%s %u,%u,%u,%u,%u,%u\r\n",
-		       "PORT", a1, a2, a3, a4, a5, a6);
-#endif
 
 	nlen = strlen(newbuf);
 	inc = nlen - olen;
@@ -806,15 +800,9 @@ ipf_p_ftp_pasv(ipf_ftp_softc_t *softf, f
 	a4 = a1 & 0xff;
 	a1 >>= 24;
 
-#if defined(SNPRINTF) && defined(_KERNEL)
-	SNPRINTF(newbuf, sizeof(newbuf), "%s %s%u,%u,%u,%u,%u,%u%s\r\n",
+	snprintf(newbuf, sizeof(newbuf), "%s %s%u,%u,%u,%u,%u,%u%s\r\n",
 		"227 Entering Passive Mode", brackets[0], a1, a2, a3, a4,
 		a5, a6, brackets[1]);
-#else
-	(void) sprintf(newbuf, "%s %s%u,%u,%u,%u,%u,%u%s\r\n",
-		"227 Entering Passive Mode", brackets[0], a1, a2, a3, a4,
-		a5, a6, brackets[1]);
-#endif
 	return ipf_p_ftp_pasvreply(softf, fin, ip, nat, ftp, (a5 << 8 | a6),
 				   newbuf, s);
 }
@@ -1781,20 +1769,13 @@ ipf_p_ftp_eprt4(ipf_ftp_softc_t *softf, 
 	a4 = a1 & 0xff;
 	a1 >>= 24;
 	olen = s - f->ftps_rptr;
-	/* DO NOT change this to snprintf! */
 	/*
 	 * While we could force the use of | as a delimiter here, it makes
 	 * sense to preserve whatever character is being used by the systems
 	 * involved in the communication.
 	 */
-#if defined(SNPRINTF) && defined(_KERNEL)
-	SNPRINTF(newbuf, sizeof(newbuf), "%s %c1%c%u.%u.%u.%u%c%u%c\r\n",
+	snprintf(newbuf, sizeof(newbuf), "%s %c1%c%u.%u.%u.%u%c%u%c\r\n",
 		 "EPRT", delim, delim, a1, a2, a3, a4, delim, port, delim);
-#else
-	(void) sprintf(newbuf, "%s %c1%c%u.%u.%u.%u%c%u%c\r\n",
-		       "EPRT", delim, delim, a1, a2, a3, a4, delim, port,
-			delim);
-#endif
 
 	nlen = strlen(newbuf);
 	inc = nlen - olen;
@@ -1892,13 +1873,8 @@ ipf_p_ftp_epsv(ipf_ftp_softc_t *softf, f
 	}
 	s += 2;
 
-#if defined(SNPRINTF) && defined(_KERNEL)
-	SNPRINTF(newbuf, sizeof(newbuf), "%s (|||%u|)\r\n",
+	snprintf(newbuf, sizeof(newbuf), "%s (|||%u|)\r\n",
 		 "229 Entering Extended Passive Mode", ap);
-#else
-	(void) sprintf(newbuf, "%s (|||%u|)\r\n",
-		       "229 Entering Extended Passive Mode", ap);
-#endif
 
 	return ipf_p_ftp_pasvreply(softf, fin, ip, nat, ftp, (u_int)ap,
 				   newbuf, s);
@@ -2038,47 +2014,26 @@ ipf_p_ftp_eprt6(ipf_ftp_softc_t *softf, 
 	 */
 	s = newbuf;
 	left = sizeof(newbuf);
-#if defined(SNPRINTF) && defined(_KERNEL)
-	SNPRINTF(newbuf, left, "EPRT %c2%c", delim, delim);
+	snprintf(newbuf, left, "EPRT %c2%c", delim, delim);
 	left -= strlen(s) + 1;
 	s += strlen(s);
 	a = ntohl(a6->i6[0]);
-	SNPRINTF(s, left, "%x:%x:", a >> 16, a & 0xffff);
-	left -= strlen(s);
-	s += strlen(s);
-	a = ntohl(a6->i6[1]);
-	SNPRINTF(s, left, "%x:%x:", a >> 16, a & 0xffff);
+	snprintf(s, left, "%x:%x:", a >> 16, a & 0xffff);
 	left -= strlen(s);
 	s += strlen(s);
-	a = ntohl(a6->i6[2]);
-	SNPRINTF(s, left, "%x:%x:", a >> 16, a & 0xffff);
-	left -= strlen(s);
-	s += strlen(s);
-	a = ntohl(a6->i6[3]);
-	SNPRINTF(s, left, "%x:%x", a >> 16, a & 0xffff);
-	left -= strlen(s);
-	s += strlen(s);
-	sprintf(s, "|%d|\r\n", port);
-#else
-	(void) sprintf(s, "EPRT %c2%c", delim, delim);
-	s += strlen(s);
-	a = ntohl(a6->i6[0]);
-	sprintf(s, "%x:%x:", a >> 16, a & 0xffff);
-	s += strlen(s);
 	a = ntohl(a6->i6[1]);
-	sprintf(s, "%x:%x:", a >> 16, a & 0xffff);
+	snprintf(s, left, "%x:%x:", a >> 16, a & 0xffff);
 	left -= strlen(s);
 	s += strlen(s);
 	a = ntohl(a6->i6[2]);
-	sprintf(s, "%x:%x:", a >> 16, a & 0xffff);
+	snprintf(s, left, "%x:%x:", a >> 16, a & 0xffff);
 	left -= strlen(s);
 	s += strlen(s);
 	a = ntohl(a6->i6[3]);
-	sprintf(s, "%x:%x", a >> 16, a & 0xffff);
+	snprintf(s, left, "%x:%x", a >> 16, a & 0xffff);
 	left -= strlen(s);
 	s += strlen(s);
-	sprintf(s, "|%d|\r\n", port);
-#endif
+	snprintf(s, left, "|%d|\r\n", port);
 	nlen = strlen(newbuf);
 	inc = nlen - olen;
 	if ((inc + fin->fin_plen) > 65535) {
Index: src/sys/external/bsd/ipf/netinet/radix_ipf.c
diff -u src/sys/external/bsd/ipf/netinet/radix_ipf.c:1.4 src/sys/external/bsd/ipf/netinet/radix_ipf.c:1.5
--- src/sys/external/bsd/ipf/netinet/radix_ipf.c:1.4	Sun Sep 15 05:38:28 2013
+++ src/sys/external/bsd/ipf/netinet/radix_ipf.c	Thu Mar 20 16:43:12 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: radix_ipf.c,v 1.4 2013/09/15 09:38:28 martin Exp $	*/
+/*	$NetBSD: radix_ipf.c,v 1.5 2014/03/20 20:43:12 christos Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -1393,11 +1393,11 @@ add_addr(rnh, n, item)
 	setmask(&stp->mask, ttable[item].mask);
 	stp->next = myst_top;
 	myst_top = stp;
-	(void) sprintf(rn[0].name, "_BORN.0");
-	(void) sprintf(rn[1].name, "_BORN.1");
+	(void) snprintf(rn[0].name, sizeof(rn[0].name), "_BORN.0");
+	(void) snprintf(rn[1].name, sizeof(rn[1].name), "_BORN.1");
 	rn = ipf_rx_addroute(rnh, &stp->dst, &stp->mask, stp->nodes);
-	(void) sprintf(rn[0].name, "%d_NODE.0", item);
-	(void) sprintf(rn[1].name, "%d_NODE.1", item);
+	(void) snprintf(rn[0].name, sizeof(rn[0].name), "%d_NODE.0", item);
+	(void) snprintf(rn[1].name, sizeof(rn[1].name), "%d_NODE.1", item);
 	printf("ADD %d/%d %s/%s\n", n, item, rn[0].name, rn[1].name);
 	nodecount++;
 	checktree(rnh);

Index: src/sys/external/bsd/ipf/netinet/ip_htable.c
diff -u src/sys/external/bsd/ipf/netinet/ip_htable.c:1.5 src/sys/external/bsd/ipf/netinet/ip_htable.c:1.6
--- src/sys/external/bsd/ipf/netinet/ip_htable.c:1.5	Wed Feb 26 20:30:18 2014
+++ src/sys/external/bsd/ipf/netinet/ip_htable.c	Thu Mar 20 16:43:12 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_htable.c,v 1.5 2014/02/27 01:30:18 joerg Exp $	*/
+/*	$NetBSD: ip_htable.c,v 1.6 2014/03/20 20:43:12 christos Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -60,7 +60,7 @@ struct file;
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_htable.c,v 1.5 2014/02/27 01:30:18 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_htable.c,v 1.6 2014/03/20 20:43:12 christos Exp $");
 #else
 static const char rcsid[] = "@(#)Id: ip_htable.c,v 1.1.1.2 2012/07/22 13:45:19 darrenr Exp";
 #endif
@@ -326,11 +326,7 @@ ipf_htable_create(ipf_main_softc_t *soft
 		i = IPHASH_ANON;
 		do {
 			i++;
-#if defined(SNPRINTF) && defined(_KERNEL)
-			SNPRINTF(name, sizeof(name), "%u", i);
-#else
-			(void)sprintf(name, "%u", i);
-#endif
+			snprintf(name, sizeof(name), "%u", i);
 			for (oiph = softh->ipf_htables[unit + 1]; oiph != NULL;
 			     oiph = oiph->iph_next)
 				if (strncmp(oiph->iph_name, name,

Reply via email to