From 9462167aa18776bf92c161a3c65740189ffe8912 Mon Sep 17 00:00:00 2001
From: Sascha Wildner <saw@online.de>
Date: Mon, 6 Jan 2014 21:26:51 +0100
Subject: [PATCH] In userland, fix printf(-like) calls without literal format
 and no args.

I.e., silence gcc's -Wformat-security warnings (in non-contrib code).
---
 games/factor/factor.c                              |  3 +--
 games/hack/hack.eat.c                              |  3 +--
 games/hack/hack.end.c                              |  4 ++--
 games/hack/hack.invent.c                           |  4 ++--
 games/hack/hack.main.c                             |  2 +-
 games/hack/hack.options.c                          |  3 +--
 games/hack/hack.pager.c                            |  4 ++--
 games/hack/hack.potion.c                           |  3 +--
 games/hack/hack.rumors.c                           |  2 +-
 games/hack/hack.timeout.c                          |  3 +--
 games/hunt/hunt/hunt.c                             |  5 ++---
 lib/libc/sys/stack_protector.c                     |  2 +-
 lib/libtcplay/io.c                                 |  2 +-
 lib/libypclnt/ypclnt_passwd.c                      |  4 ++--
 libexec/ftpd/ftpd.c                                |  2 +-
 libexec/telnetd/utility.c                          |  8 ++++----
 sbin/disklabel32/disklabel.c                       |  4 ++--
 sbin/ip6fw/ip6fw.c                                 | 12 ++++++------
 sbin/ipfw/ipfw2.c                                  |  2 +-
 sbin/sysctl/sysctl.c                               |  2 +-
 usr.bin/ee/ee.c                                    |  8 ++++----
 usr.bin/evtranalyze/evtranalyze.c                  |  8 ++++----
 usr.bin/indent/io.c                                |  4 ++--
 usr.bin/ktrdump/ktrdump.c                          |  8 ++++----
 usr.bin/mkesdb/yacc.y                              |  2 +-
 usr.bin/rpcgen/rpc_hout.c                          |  3 +--
 usr.bin/rpcgen/rpc_svcout.c                        |  2 +-
 usr.bin/rpcgen/rpc_tblout.c                        |  5 ++---
 usr.bin/telnet/utilities.c                         |  8 ++++----
 usr.sbin/atm/scspd/scsp_config_parse.y             |  3 +--
 usr.sbin/installer/dfuibe_installer/fn_configure.c |  8 ++++----
 usr.sbin/installer/dfuibe_installer/fn_disk.c      |  6 +++---
 usr.sbin/installer/libdfui/conn_npipe.c            |  4 ++--
 usr.sbin/installer/libinstaller/commands.c         |  2 +-
 usr.sbin/mfiutil/mfi_show.c                        |  2 +-
 usr.sbin/pfctl/parse.y                             |  2 +-
 usr.sbin/pstat/pstat.c                             |  4 ++--
 37 files changed, 72 insertions(+), 81 deletions(-)

diff --git a/games/factor/factor.c b/games/factor/factor.c
index 9764008..520f65c 100644
--- a/games/factor/factor.c
+++ b/games/factor/factor.c
@@ -33,7 +33,6 @@
  * @(#)factor.c	8.4 (Berkeley) 5/4/95
  * $NetBSD: factor.c,v 1.13 2002/06/18 23:07:36 simonb Exp $
  * $FreeBSD: src/games/factor/factor.c,v 1.9.2.2 2002/10/23 14:59:14 fanf Exp $
- * $DragonFly: src/games/factor/factor.c,v 1.2 2003/06/17 04:25:23 dillon Exp $
  */
 
 /*
@@ -293,7 +292,7 @@ BN_print_dec_fp(FILE *fp, const BIGNUM *num)
 	buf = BN_bn2dec(num);
 	if (buf == NULL)
 		return;	/* XXX do anything here? */
-	fprintf(fp, buf);
+	fprintf(fp, "%s", buf);
 	free(buf);
 }
 
diff --git a/games/hack/hack.eat.c b/games/hack/hack.eat.c
index c2b01ed..6373bc5 100644
--- a/games/hack/hack.eat.c
+++ b/games/hack/hack.eat.c
@@ -1,7 +1,6 @@
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* hack.eat.c - version 1.0.3 */
 /* $FreeBSD: src/games/hack/hack.eat.c,v 1.4 1999/11/16 10:26:36 marcel Exp $ */
-/* $DragonFly: src/games/hack/hack.eat.c,v 1.5 2006/08/21 19:45:32 pavalos Exp $ */
 
 #include "hack.h"
 char POISONOUS[] = "ADKSVabhks";
@@ -71,7 +70,7 @@ opentin(void)
 	useup(tin.tin);
 	r = rn2(2 * TTSZ);
 	if (r < TTSZ) {
-		pline(tintxts[r].txt);
+		pline("%s", tintxts[r].txt);
 		lesshungry(tintxts[r].nut);
 		if (r == 1) {	/* SALMON */
 			Glib = rnd(15);
diff --git a/games/hack/hack.end.c b/games/hack/hack.end.c
index c2e948a..25e5382 100644
--- a/games/hack/hack.end.c
+++ b/games/hack/hack.end.c
@@ -468,7 +468,7 @@ outentry(int rank, struct toptenentry *t1, int so)
 		if (t1->maxlvl != t1->level)
 			Sprintf(eos(linebuf), " [max %d]", t1->maxlvl);
 		if (quit && t1->death[4])
-			Sprintf(eos(linebuf), t1->death + 4);
+			Sprintf(eos(linebuf), "%s", t1->death + 4);
 	}
 	if (dead) {
 		Sprintf(eos(linebuf), " by %s%s",
@@ -484,7 +484,7 @@ outentry(int rank, struct toptenentry *t1, int so)
 		char hpbuf[10];
 		int hppos;
 
-		Sprintf(hpbuf, (t1->hp > 0) ? itoa(t1->hp) : "-");
+		Sprintf(hpbuf, "%s", (t1->hp > 0) ? itoa(t1->hp) : "-");
 		hppos = COLNO - 7 - strlen(hpbuf);
 		if (bp <= linebuf + hppos) {
 			while (bp < linebuf + hppos)
diff --git a/games/hack/hack.invent.c b/games/hack/hack.invent.c
index a95efbd..bae4b75 100644
--- a/games/hack/hack.invent.c
+++ b/games/hack/hack.invent.c
@@ -593,7 +593,7 @@ askchain(struct obj *objchn, char *olets, int allflag,
 		if (ckfn && !(*ckfn)(otmp))
 			continue;
 		if (!allflag) {
-			pline(xprname(otmp, ilet));
+			pline("%s", xprname(otmp, ilet));
 			addtopl(" [nyaq]? ");
 			sym = readchar();
 		} else
@@ -637,7 +637,7 @@ obj_to_let(struct obj *obj)
 void
 prinv(struct obj *obj)
 {
-	pline(xprname(obj, obj_to_let(obj)));
+	pline("%s", xprname(obj, obj_to_let(obj)));
 }
 
 static char *
diff --git a/games/hack/hack.main.c b/games/hack/hack.main.c
index 8718e1c..d17bdd9 100644
--- a/games/hack/hack.main.c
+++ b/games/hack/hack.main.c
@@ -339,7 +339,7 @@ not_recovered:
 		}
 		if (multi < 0) {
 			if (!++multi) {
-				pline(nomovemsg ? nomovemsg :
+				pline("%s", nomovemsg ? nomovemsg :
 				      "You can move again.");
 				nomovemsg = 0;
 				if (afternmv)
diff --git a/games/hack/hack.options.c b/games/hack/hack.options.c
index 920bdb3..63a8c2a 100644
--- a/games/hack/hack.options.c
+++ b/games/hack/hack.options.c
@@ -1,7 +1,6 @@
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* hack.options.c - version 1.0.3 */
 /* $FreeBSD: src/games/hack/hack.options.c,v 1.5 1999/11/16 02:57:08 billf Exp $ */
-/* $DragonFly: src/games/hack/hack.options.c,v 1.3 2006/08/21 19:45:32 pavalos Exp $ */
 
 #include "hack.h"
 
@@ -210,7 +209,7 @@ doset(void)
 			if (*--eop == ',')
 				*eop = 0;
 		}
-		pline(buf);
+		pline("%s", buf);
 	} else
 		parseoptions(buf, FALSE);
 
diff --git a/games/hack/hack.pager.c b/games/hack/hack.pager.c
index 121e962..b8f7080 100644
--- a/games/hack/hack.pager.c
+++ b/games/hack/hack.pager.c
@@ -43,7 +43,7 @@ dowhatis(void)
 						buf[0] = q;
 						strncpy(buf + 1, "       ", 7);
 					}
-					pline(buf);
+					pline("%s", buf);
 					if (ep[-1] == ';') {
 						pline("More info? ");
 						if (readchar() == 'y') {
@@ -231,7 +231,7 @@ cornline(int mode, const char *text)
 
 	/* --- now we really do it --- */
 	if (mode == 2 && linect == 1)	/* topline only */
-		pline(texthead->line_text);
+		pline("%s", texthead->line_text);
 	else if (mode == 2) {
 		int curline, lth;
 
diff --git a/games/hack/hack.potion.c b/games/hack/hack.potion.c
index aa52b28..e7879db 100644
--- a/games/hack/hack.potion.c
+++ b/games/hack/hack.potion.c
@@ -1,7 +1,6 @@
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* hack.potion.c - version 1.0.3 */
 /* $FreeBSD: src/games/hack/hack.potion.c,v 1.5 1999/11/16 10:26:37 marcel Exp $ */
-/* $DragonFly: src/games/hack/hack.potion.c,v 1.4 2006/08/21 19:45:32 pavalos Exp $ */
 
 #include "hack.h"
 extern struct monst youmonst;
@@ -223,7 +222,7 @@ strange_feeling(struct obj *obj, const char *txt)
 	if (flags.beginner)
 		pline("You have a strange feeling for a moment, then it passes.");
 	else
-		pline(txt);
+		pline("%s", txt);
 	if (!objects[obj->otyp].oc_name_known && !objects[obj->otyp].oc_uname)
 		docall(obj);
 	useup(obj);
diff --git a/games/hack/hack.rumors.c b/games/hack/hack.rumors.c
index fd6a45b..5453732 100644
--- a/games/hack/hack.rumors.c
+++ b/games/hack/hack.rumors.c
@@ -52,7 +52,7 @@ outline(FILE *rumf)
 	if ((ep = strchr(line, '\n')) != NULL)
 		*ep = 0;
 	pline("This cookie has a scrap of paper inside! It reads: ");
-	pline(line);
+	pline("%s", line);
 }
 
 void
diff --git a/games/hack/hack.timeout.c b/games/hack/hack.timeout.c
index 88862f6..005e000 100644
--- a/games/hack/hack.timeout.c
+++ b/games/hack/hack.timeout.c
@@ -1,7 +1,6 @@
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* hack.timeout.c - version 1.0.3 */
 /* $FreeBSD: src/games/hack/hack.timeout.c,v 1.3 1999/11/16 02:57:12 billf Exp $ */
-/* $DragonFly: src/games/hack/hack.timeout.c,v 1.4 2006/08/21 19:45:32 pavalos Exp $ */
 
 #include "hack.h"
 
@@ -65,7 +64,7 @@ stoned_dialogue(void)
 	long i = (Stoned & TIMEOUT);
 
 	if (i > 0 && i <= SIZE(stoned_texts))
-		pline(stoned_texts[SIZE(stoned_texts) - i]);
+		pline("%s", stoned_texts[SIZE(stoned_texts) - i]);
 	if (i == 5)
 		Fast = 0;
 	if (i == 3)
diff --git a/games/hunt/hunt/hunt.c b/games/hunt/hunt/hunt.c
index c995511..6f1858e 100644
--- a/games/hunt/hunt/hunt.c
+++ b/games/hunt/hunt/hunt.c
@@ -30,7 +30,6 @@
  *
  * $OpenBSD: hunt.c,v 1.13 2008/03/17 09:17:56 sobrado Exp $
  * $NetBSD: hunt.c,v 1.8 1998/09/13 15:27:28 hubertf Exp $
- * $DragonFly: src/games/hunt/hunt/hunt.c,v 1.2 2008/09/04 16:12:51 swildner Exp $
  */
 
 #include <ctype.h>
@@ -517,9 +516,9 @@ leave(int eval, const char *mesg)
 	errno = saved_errno;
 
 	if (errno == 0 && mesg != NULL)
-		errx(eval, mesg);
+		errx(eval, "%s", mesg);
 	else if (mesg != NULL)
-		err(eval, mesg);
+		err(eval, "%s", mesg);
 	exit(eval);
 }
 
diff --git a/lib/libc/sys/stack_protector.c b/lib/libc/sys/stack_protector.c
index c90570a..2ad1c23 100644
--- a/lib/libc/sys/stack_protector.c
+++ b/lib/libc/sys/stack_protector.c
@@ -88,7 +88,7 @@ __fail(const char *msg)
     _sigprocmask(SIG_BLOCK, &mask, NULL);
 
     /* This may fail on a chroot jail... */
-    syslog(LOG_CRIT, msg);
+    syslog(LOG_CRIT, "%s", msg);
 
     bzero(&sa, sizeof(struct sigaction));
     sigemptyset(&sa.sa_mask);
diff --git a/lib/libtcplay/io.c b/lib/libtcplay/io.c
index e43c824..a19553f 100644
--- a/lib/libtcplay/io.c
+++ b/lib/libtcplay/io.c
@@ -350,7 +350,7 @@ read_passphrase(const char *prompt, char *pass, size_t passlen, time_t timeout)
 		cfd = 1;
 	}
 
-	printf(prompt);
+	printf("%s", prompt);
 	fflush(stdout);
 
 	memset(pass, 0, passlen);
diff --git a/lib/libypclnt/ypclnt_passwd.c b/lib/libypclnt/ypclnt_passwd.c
index d17a4b9..330d68d 100644
--- a/lib/libypclnt/ypclnt_passwd.c
+++ b/lib/libypclnt/ypclnt_passwd.c
@@ -158,7 +158,7 @@ yppasswd_local(ypclnt_t *ypclnt, const struct passwd *pwd)
 	    (yppwd.newpw.pw_gecos = strdup(pwd->pw_gecos)) == NULL ||
 	    (yppwd.newpw.pw_dir = strdup(pwd->pw_dir)) == NULL ||
 	    (yppwd.newpw.pw_shell = strdup(pwd->pw_shell)) == NULL) {
-		ypclnt_error(ypclnt, __func__, strerror(errno));
+		ypclnt_error(ypclnt, __func__, "%s", strerror(errno));
 		ret = -1;
 		goto done;
 	}
@@ -251,7 +251,7 @@ yppasswd_remote(ypclnt_t *ypclnt, const struct passwd *pwd, const char *passwd)
 	    (yppwd.newpw.pw_dir = strdup(pwd->pw_dir)) == NULL ||
 	    (yppwd.newpw.pw_shell = strdup(pwd->pw_shell)) == NULL ||
 	    (yppwd.oldpass = strdup(passwd ? passwd : "")) == NULL) {
-		ypclnt_error(ypclnt, __func__, strerror(errno));
+		ypclnt_error(ypclnt, __func__, "%s", strerror(errno));
 		ret = -1;
 		goto done;
 	}
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index 518284a..fc436fe 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -2113,7 +2113,7 @@ send_data(FILE *instr, FILE *outstr, size_t blksize, off_t filesize, int isreg)
 				}
 			}
 			ENDXFER;
-			reply(226, msg);
+			reply(226, "%s", msg);
 			return (0);
 		}
 
diff --git a/libexec/telnetd/utility.c b/libexec/telnetd/utility.c
index 4956704..7e94891 100644
--- a/libexec/telnetd/utility.c
+++ b/libexec/telnetd/utility.c
@@ -838,22 +838,22 @@ printsub(char direction, unsigned char *pointer, int length)
 		    for (i = 2; i < length; i++ ) {
 			switch (pointer[i]) {
 			case NEW_ENV_VAR:
-			    output_data("\" VAR " + noquote);
+			    output_data("%s", "\" VAR " + noquote);
 			    noquote = 2;
 			    break;
 
 			case NEW_ENV_VALUE:
-			    output_data("\" VALUE " + noquote);
+			    output_data("%s", "\" VALUE " + noquote);
 			    noquote = 2;
 			    break;
 
 			case ENV_ESC:
-			    output_data("\" ESC " + noquote);
+			    output_data("%s", "\" ESC " + noquote);
 			    noquote = 2;
 			    break;
 
 			case ENV_USERVAR:
-			    output_data("\" USERVAR " + noquote);
+			    output_data("%s", "\" USERVAR " + noquote);
 			    noquote = 2;
 			    break;
 
diff --git a/sbin/disklabel32/disklabel.c b/sbin/disklabel32/disklabel.c
index 6881985..7b29d28 100644
--- a/sbin/disklabel32/disklabel.c
+++ b/sbin/disklabel32/disklabel.c
@@ -408,7 +408,7 @@ writelabel(int f, const char *boot, struct disklabel32 *lp)
 				warn("ioctl DIOCWLABEL");
 			msg = fixlabel(f, lp, 1);
 			if (msg) {
-				warn(msg);
+				warn("%s", msg);
 				return (1);
 			}
 			r = write(f, boot, lp->d_bbsize);
@@ -506,7 +506,7 @@ readlabel(int f)
 				"or pack is unlabeled)");
 		}
 		if ((msg = fixlabel(f, lp, 0)) != NULL)
-			errx(1, msg);
+			errx(1, "%s", msg);
 	} else {
 		lp = &lab;
 		if (ioctl(f, DIOCGDINFO32, lp) < 0) {
diff --git a/sbin/ip6fw/ip6fw.c b/sbin/ip6fw/ip6fw.c
index 0ad4d1d..b09d304 100644
--- a/sbin/ip6fw/ip6fw.c
+++ b/sbin/ip6fw/ip6fw.c
@@ -286,7 +286,7 @@ show_ip6fw(struct ip6_fw *chain)
 	if (mb==128 && do_resolv) {
 		he=gethostbyaddr(&(chain->fw_src),sizeof(chain->fw_src),AF_INET6);
 		if (he==NULL) {
-			printf(inet_ntop(AF_INET6,&chain->fw_src,ntop_buf,sizeof(ntop_buf)));
+			printf("%s", inet_ntop(AF_INET6,&chain->fw_src,ntop_buf,sizeof(ntop_buf)));
 		} else
 			printf("%s",he->h_name);
 	} else {
@@ -294,11 +294,11 @@ show_ip6fw(struct ip6_fw *chain)
 			if (mb == 0) {
 				printf("any");
 			} else {
-				printf(inet_ntop(AF_INET6,&chain->fw_src,ntop_buf,sizeof(ntop_buf)));
+				printf("%s", inet_ntop(AF_INET6,&chain->fw_src,ntop_buf,sizeof(ntop_buf)));
 				printf("/%d",mb);
 			}
 		} else
-			printf(inet_ntop(AF_INET6,&chain->fw_src,ntop_buf,sizeof(ntop_buf)));
+			printf("%s", inet_ntop(AF_INET6,&chain->fw_src,ntop_buf,sizeof(ntop_buf)));
 	}
 
 	if (chain->fw_prot == IPPROTO_TCP || chain->fw_prot == IPPROTO_UDP) {
@@ -318,7 +318,7 @@ show_ip6fw(struct ip6_fw *chain)
 	if (mb==128 && do_resolv) {
 		he=gethostbyaddr(&(chain->fw_dst),sizeof(chain->fw_dst),AF_INET6);
 		if (he==NULL) {
-			printf(inet_ntop(AF_INET6,&chain->fw_dst,ntop_buf,sizeof(ntop_buf)));
+			printf("%s", inet_ntop(AF_INET6,&chain->fw_dst,ntop_buf,sizeof(ntop_buf)));
 		} else
 			printf("%s",he->h_name);
 	} else {
@@ -326,11 +326,11 @@ show_ip6fw(struct ip6_fw *chain)
 			if (mb == 0) {
 				printf("any");
 			} else {
-				printf(inet_ntop(AF_INET6,&chain->fw_dst,ntop_buf,sizeof(ntop_buf)));
+				printf("%s", inet_ntop(AF_INET6,&chain->fw_dst,ntop_buf,sizeof(ntop_buf)));
 				printf("/%d",mb);
 			}
 		} else
-			printf(inet_ntop(AF_INET6,&chain->fw_dst,ntop_buf,sizeof(ntop_buf)));
+			printf("%s", inet_ntop(AF_INET6,&chain->fw_dst,ntop_buf,sizeof(ntop_buf)));
 	}
 
 	if (chain->fw_prot == IPPROTO_TCP || chain->fw_prot == IPPROTO_UDP) {
diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c
index be1a2d6..7027fb9 100644
--- a/sbin/ipfw/ipfw2.c
+++ b/sbin/ipfw/ipfw2.c
@@ -413,7 +413,7 @@ print_newports(ipfw_insn_u16 *cmd, int proto, int opcode)
 		printf ("%s", opcode == O_MAC_TYPE ? " mac-type" :
 		    (opcode == O_IP_DSTPORT ? " dst-port" : " src-port"));
 	for (i = F_LEN((ipfw_insn *)cmd) - 1; i > 0; i--, p += 2) {
-		printf(sep);
+		printf("%s", sep);
 		print_port(proto, p[0]);
 		if (p[0] != p[1]) {
 			printf("-");
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
index a36d009..14f9d89 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -448,7 +448,7 @@ S_sensor(int l2, void *p)
 				name = "unknown";
 				break;
 			}
-			printf(name);
+			printf("%s", name);
 			break;
 		}
 		case SENSOR_TIMEDELTA:
diff --git a/usr.bin/ee/ee.c b/usr.bin/ee/ee.c
index 342b81d..ed4a24b 100644
--- a/usr.bin/ee/ee.c
+++ b/usr.bin/ee/ee.c
@@ -2052,10 +2052,10 @@ get_options(int numargs, char **arguments)
 		else if (!strcmp("-?", buff))
 		{
 			fprintf(stderr, usage0, arguments[0]);
-			fprintf(stderr, usage1);
-			fprintf(stderr, usage2);
-			fprintf(stderr, usage3);
-			fprintf(stderr, usage4);
+			fprintf(stderr, "%s", usage1);
+			fprintf(stderr, "%s", usage2);
+			fprintf(stderr, "%s", usage3);
+			fprintf(stderr, "%s", usage4);
 			exit(1);
 		}
 		else if (*buff == '+')
diff --git a/usr.bin/evtranalyze/evtranalyze.c b/usr.bin/evtranalyze/evtranalyze.c
index c0148eb..48867f1 100644
--- a/usr.bin/evtranalyze/evtranalyze.c
+++ b/usr.bin/evtranalyze/evtranalyze.c
@@ -523,7 +523,7 @@ do_pass(struct pass_hook *hooks, int nhooks)
 		}
 	}
 	if (evtr_query_error(q)) {
-		err(1, evtr_query_errmsg(q));
+		err(1, "%s", evtr_query_errmsg(q));
 	}
 	evtr_query_destroy(q);
 
@@ -1054,7 +1054,7 @@ cmd_show(int argc, char **argv)
 		last_ts = ev.ts;
 	}
 	if (evtr_query_error(q)) {
-		err(1, evtr_query_errmsg(q));
+		err(1, "%s", evtr_query_errmsg(q));
 	}
 	evtr_query_destroy(q);
 	return 0;
@@ -1412,7 +1412,7 @@ cmd_stats(int argc, char **argv)
 		last_ts = ev.ts;
 	}
 	if (evtr_query_error(q)) {
-		err(1, evtr_query_errmsg(q));
+		err(1, "%s", evtr_query_errmsg(q));
 	}
 	evtr_query_destroy(q);
 	statsops->report(statctx);
@@ -1453,7 +1453,7 @@ cmd_summary(int argc, char **argv)
 		c->firstlast.end = ev.ts;
 	}
 	if (evtr_query_error(q)) {
-		err(1, evtr_query_errmsg(q));
+		err(1, "%s", evtr_query_errmsg(q));
 	}
 	evtr_query_destroy(q);
 
diff --git a/usr.bin/indent/io.c b/usr.bin/indent/io.c
index 66a6cb1..c29c675 100644
--- a/usr.bin/indent/io.c
+++ b/usr.bin/indent/io.c
@@ -571,12 +571,12 @@ diag2(int level, const char *msg)
 	found_err = 1;
     if (output == stdout) {
 	fprintf(stdout, "/**INDENT** %s@%d: ", level == 0 ? "Warning" : "Error", line_no);
-	fprintf(stdout, msg);
+	fprintf(stdout, "%s", msg);
 	fprintf(stdout, " */\n");
     }
     else {
 	fprintf(stderr, "%s@%d: ", level == 0 ? "Warning" : "Error", line_no);
-	fprintf(stderr, msg);
+	fprintf(stderr, "%s", msg);
 	fprintf(stderr, "\n");
     }
 }
diff --git a/usr.bin/ktrdump/ktrdump.c b/usr.bin/ktrdump/ktrdump.c
index 1186f63..bc97a23 100644
--- a/usr.bin/ktrdump/ktrdump.c
+++ b/usr.bin/ktrdump/ktrdump.c
@@ -375,7 +375,7 @@ dump_devinfo(struct devinfo_dev *dev, void *arg)
 	ev.fmtdatalen = sizeof(fmtdatabuf);
 
 	if (evtr_dump_event(evtr, &ev)) {
-		err(1, evtr_errmsg(evtr));
+		err(1, "%s", evtr_errmsg(evtr));
 	}
 
 	return devinfo_foreach_device_child(dev, dump_devinfo, evtr);
@@ -407,7 +407,7 @@ dump_machine_info(evtr_t evtr)
 	ev.ncpus = ncpus;
 	evtr_dump_event(evtr, &ev);
 	if (evtr_error(evtr)) {
-		err(1, evtr_errmsg(evtr));
+		err(1, "%s", evtr_errmsg(evtr));
 	}
 
 	for (i = 0; i < ncpus; ++i) {
@@ -417,7 +417,7 @@ dump_machine_info(evtr_t evtr)
 		ev.cpuinfo.freq = tsc_frequency;
 		evtr_dump_event(evtr, &ev);
 		if (evtr_error(evtr)) {
-			err(1, evtr_errmsg(evtr));
+			err(1, "%s", evtr_errmsg(evtr));
 		}
 	}
 }
@@ -666,7 +666,7 @@ dump_callback(void *ctx, int n, int row __unused, struct ktr_entry *entry,
 		ev.fmtdatalen = 0;
 	}
 	if (evtr_dump_event(evtr, &ev)) {
-		err(1, evtr_errmsg(evtr));
+		err(1, "%s", evtr_errmsg(evtr));
 	}
 	if (ev.fmtdata && conv) {
 		mangle_string_ptrs(ev.fmt, __DECONST(uint8_t *, ev.fmtdata),
diff --git a/usr.bin/mkesdb/yacc.y b/usr.bin/mkesdb/yacc.y
index 5af12dc..d56013e 100644
--- a/usr.bin/mkesdb/yacc.y
+++ b/usr.bin/mkesdb/yacc.y
@@ -324,7 +324,7 @@ main(int argc, char **argv)
 	case 1:
 		in = fopen(argv[0], "r");
 		if (!in)
-			err(EXIT_FAILURE, argv[0]);
+			err(EXIT_FAILURE, "%s", argv[0]);
 		break;
 	default:
 		usage();
diff --git a/usr.bin/rpcgen/rpc_hout.c b/usr.bin/rpcgen/rpc_hout.c
index 94d74e3..ba3f754 100644
--- a/usr.bin/rpcgen/rpc_hout.c
+++ b/usr.bin/rpcgen/rpc_hout.c
@@ -28,7 +28,6 @@
  *
  * @(#)rpc_hout.c	1.16	94/04/25 SMI; 1.12 89/02/22 (C) 1987 SMI
  * $FreeBSD: src/usr.bin/rpcgen/rpc_hout.c,v 1.15 2005/11/13 21:17:24 dwmalone Exp $
- * $DragonFly: src/usr.bin/rpcgen/rpc_hout.c,v 1.5 2004/06/19 16:40:36 joerg Exp $
  */
 
 /*
@@ -480,7 +479,7 @@ pdeclaration(const char *name, declaration *dec, int tab, const char *separator)
 			break;
 		}
 	}
-	f_print(fout, separator);
+	f_print(fout, "%s", separator);
 }
 
 static int
diff --git a/usr.bin/rpcgen/rpc_svcout.c b/usr.bin/rpcgen/rpc_svcout.c
index 4621634..5de6916 100644
--- a/usr.bin/rpcgen/rpc_svcout.c
+++ b/usr.bin/rpcgen/rpc_svcout.c
@@ -333,7 +333,7 @@ write_real_program(definition *def)
 			f_print(fout, "(");
 			/* arg name */
 			if (proc->arg_num > 1)
-				f_print(fout, proc->args.argname);
+				f_print(fout, "%s", proc->args.argname);
 			else
 				ptype(proc->args.decls->decl.prefix,
 				      proc->args.decls->decl.type, 0);
diff --git a/usr.bin/rpcgen/rpc_tblout.c b/usr.bin/rpcgen/rpc_tblout.c
index ccbb5e4..1730353 100644
--- a/usr.bin/rpcgen/rpc_tblout.c
+++ b/usr.bin/rpcgen/rpc_tblout.c
@@ -28,7 +28,6 @@
  *
  * @(#)rpc_tblout.c	1.11	93/07/05 SMI; 1.4 89/02/22 (C) 1988 SMI
  * $FreeBSD: src/usr.bin/rpcgen/rpc_tblout.c,v 1.12 2005/11/13 21:17:24 dwmalone Exp $
- * $DragonFly: src/usr.bin/rpcgen/rpc_tblout.c,v 1.4 2004/06/19 16:40:36 joerg Exp $
  */
 
 /*
@@ -97,7 +96,7 @@ write_table(definition *def)
 			expected = 0;
 		} else {
 			expected = 1;
-			f_print(fout, null_entry);
+			f_print(fout, "%s", null_entry);
 		}
 		for (proc = vp->procs; proc != NULL; proc = proc->next) {
 			current = atoi(proc->proc_num);
@@ -139,7 +138,7 @@ write_table(definition *def)
 		}
 
 		/* print the table trailer */
-		f_print(fout, tbl_end);
+		f_print(fout, "%s", tbl_end);
 		f_print(fout, tbl_nproc, progvers, progvers, progvers);
 	}
 }
diff --git a/usr.bin/telnet/utilities.c b/usr.bin/telnet/utilities.c
index 938bd1f..76c82a1 100644
--- a/usr.bin/telnet/utilities.c
+++ b/usr.bin/telnet/utilities.c
@@ -773,7 +773,7 @@ printsub(char direction, unsigned char *pointer, int length)
 				    fprintf(NetTrace, "\" VAR " + noquote);
 			    } else
 #endif /* OLD_ENVIRON */
-				fprintf(NetTrace, "\" VALUE " + noquote);
+				fprintf(NetTrace, "%s", "\" VALUE " + noquote);
 			    noquote = 2;
 			    break;
 
@@ -789,17 +789,17 @@ printsub(char direction, unsigned char *pointer, int length)
 				    fprintf(NetTrace, "\" VALUE " + noquote);
 			    } else
 #endif /* OLD_ENVIRON */
-				fprintf(NetTrace, "\" VAR " + noquote);
+				fprintf(NetTrace, "%s", "\" VAR " + noquote);
 			    noquote = 2;
 			    break;
 
 			case ENV_ESC:
-			    fprintf(NetTrace, "\" ESC " + noquote);
+			    fprintf(NetTrace, "%s", "\" ESC " + noquote);
 			    noquote = 2;
 			    break;
 
 			case ENV_USERVAR:
-			    fprintf(NetTrace, "\" USERVAR " + noquote);
+			    fprintf(NetTrace, "%s", "\" USERVAR " + noquote);
 			    noquote = 2;
 			    break;
 
diff --git a/usr.sbin/atm/scspd/scsp_config_parse.y b/usr.sbin/atm/scspd/scsp_config_parse.y
index af885fe..437ecd5 100644
--- a/usr.sbin/atm/scspd/scsp_config_parse.y
+++ b/usr.sbin/atm/scspd/scsp_config_parse.y
@@ -25,7 +25,6 @@
  * notice must be reproduced on all copies.
  *
  *	@(#) $FreeBSD: src/usr.sbin/atm/scspd/scsp_config_parse.y,v 1.3 1999/08/28 01:15:32 peter Exp $
- *	@(#) $DragonFly: src/usr.sbin/atm/scspd/scsp_config_parse.y,v 1.4 2008/11/12 21:44:59 swildner Exp $
  */
 
 
@@ -392,5 +391,5 @@ parse_error(const char *fmt, ...)
 void
 yyerror(char *s)
 {
-	parse_error(s);
+	parse_error("%s", s);
 }
diff --git a/usr.sbin/installer/dfuibe_installer/fn_configure.c b/usr.sbin/installer/dfuibe_installer/fn_configure.c
index 699732c..83bfd2e 100644
--- a/usr.sbin/installer/dfuibe_installer/fn_configure.c
+++ b/usr.sbin/installer/dfuibe_installer/fn_configure.c
@@ -210,7 +210,7 @@ fn_add_user(struct i_fn_args *a)
 			    strlen(home) == 0 ? "" : "-d ", home,
 			    shell,
 			    strlen(groups) == 0 ? "" : "-G ", groups,
-			    (strlen(home) == 0 || !is_dir(home)) ?
+			    (strlen(home) == 0 || !is_dir("%s", home)) ?
 			    "-m -k /usr/share/skel" : "");
 
 			cmd = command_add(cmds, "%s%s '%s' | "
@@ -678,7 +678,7 @@ fn_set_kbdmap(struct i_fn_args *a)
 		    s);
 		if (commands_execute(a, cmds)) {
 			snprintf(filename, 256, "/usr/share/syscons/keymaps/%s", s);
-			snprintf(keymapname, 256, filename_noext(basename(filename)));
+			snprintf(keymapname, 256, "%s", filename_noext(basename(filename)));
 			config_var_set(rc_conf, "keymap", keymapname);
 		} else {
 			inform(a->c, _("Keyboard map not successfully set."));
@@ -719,7 +719,7 @@ fn_set_vidfont(struct i_fn_args *a)
 
 			snprintf(variable, 256, "font8x%d", by);
 			snprintf(filename, 256, "/usr/share/syscons/fonts/%s", s);
-			snprintf(fontname, 256, filename_noext(basename(filename)));
+			snprintf(fontname, 256, "%s", filename_noext(basename(filename)));
 			config_var_set(rc_conf, variable, fontname);
 
 		} else {
@@ -752,7 +752,7 @@ fn_set_scrnmap(struct i_fn_args *a)
 		    s);
 		if (commands_execute(a, cmds)) {
 			snprintf(filename, 256, "/usr/share/syscons/scrnmaps/%s", s);
-			snprintf(scrnmapname, 256, filename_noext(basename(filename)));
+			snprintf(scrnmapname, 256, "%s", filename_noext(basename(filename)));
 			config_var_set(rc_conf, "scrnmap", scrnmapname);
 		} else {
 			inform(a->c, _("Video font not successfully set."));
diff --git a/usr.sbin/installer/dfuibe_installer/fn_disk.c b/usr.sbin/installer/dfuibe_installer/fn_disk.c
index 939d57a..11cdf97 100644
--- a/usr.sbin/installer/dfuibe_installer/fn_disk.c
+++ b/usr.sbin/installer/dfuibe_installer/fn_disk.c
@@ -484,12 +484,12 @@ fn_install_bootblocks(struct i_fn_args *a, const char *device)
 				    strcasecmp(packet, "Y") == 0 ? "" : "no",
 				    disk);
 				command_set_failure_mode(cmd, COMMAND_FAILURE_WARN);
-				command_set_tag(cmd, disk);
+				command_set_tag(cmd, "%s", disk);
 				cmd = command_add(cmds, "%s%s -v %s",
 				    a->os_root, cmd_name(a, "BOOT0CFG"),
 				    disk);
 				command_set_failure_mode(cmd, COMMAND_FAILURE_WARN);
-				command_set_tag(cmd, disk);
+				command_set_tag(cmd, "%s", disk);
 			}
 		}
 
@@ -558,7 +558,7 @@ fn_create_cdboot_floppy(struct i_fn_args *a)
 
 	switch (dfui_be_present_dialog(a->c, _("Create CDBoot Floppy"),
 	    _("Create CDBoot Floppy|Return to Utilities Menu"),
-	    msg_buf[0])) {
+	    "%s", msg_buf[0])) {
 	case 1:
 		cmds = commands_new();
 		command_add(cmds, "%s%s -c %sboot/cdboot.flp.bz2 | "
diff --git a/usr.sbin/installer/libdfui/conn_npipe.c b/usr.sbin/installer/libdfui/conn_npipe.c
index 562b100..66960f4 100644
--- a/usr.sbin/installer/libdfui/conn_npipe.c
+++ b/usr.sbin/installer/libdfui/conn_npipe.c
@@ -280,8 +280,8 @@ dfui_npipe_fe_connect(struct dfui_connection *c)
 	/*
 	 * Wait for named pipes to be created.
 	 */
-	if (!is_named_pipe(T_NPIPE(c)->in_pipename)) {
-		while (!is_named_pipe(T_NPIPE(c)->in_pipename)) {
+	if (!is_named_pipe("%s", T_NPIPE(c)->in_pipename)) {
+		while (!is_named_pipe("%s", T_NPIPE(c)->in_pipename)) {
 			sleep(1);
 		}
 		sleep(1);
diff --git a/usr.sbin/installer/libinstaller/commands.c b/usr.sbin/installer/libinstaller/commands.c
index 37aa168..0a70e1f 100644
--- a/usr.sbin/installer/libinstaller/commands.c
+++ b/usr.sbin/installer/libinstaller/commands.c
@@ -296,7 +296,7 @@ pipe_loop(struct i_fn_args *a, struct dfui_progress *pr,
 
 	asprintf(&command, "(%s) 2>&1 </dev/null", cmd->cmdline);
 	fflush(stdout);
-	cmdout = aura_popen(command, "r");
+	cmdout = aura_popen("%s", command, "r");
 	free(command);
 
 	if (cmdout == NULL) {
diff --git a/usr.sbin/mfiutil/mfi_show.c b/usr.sbin/mfiutil/mfi_show.c
index 9ecf84b..0c1b481 100644
--- a/usr.sbin/mfiutil/mfi_show.c
+++ b/usr.sbin/mfiutil/mfi_show.c
@@ -281,7 +281,7 @@ print_pd(struct mfi_pd_info *info, int state_len)
 	if (state_len > 0)
 		printf("%-*s", state_len, s);
 	else
-		printf(s);
+		printf("%s", s);
 	s = mfi_pd_inq_string(info);
 	if (s != NULL)
 		printf(" %s", s);
diff --git a/usr.sbin/pfctl/parse.y b/usr.sbin/pfctl/parse.y
index 5e107e7..ebc88b0 100644
--- a/usr.sbin/pfctl/parse.y
+++ b/usr.sbin/pfctl/parse.y
@@ -4412,7 +4412,7 @@ disallow_urpf_failed(struct node_host *h, const char *fmt)
 {
 	for (; h != NULL; h = h->next)
 		if (h->addr.type == PF_ADDR_URPFFAILED) {
-			yyerror(fmt);
+			yyerror("%s", fmt);
 			return (1);
 		}
 	return (0);
diff --git a/usr.sbin/pstat/pstat.c b/usr.sbin/pstat/pstat.c
index f405508..75500e1 100644
--- a/usr.sbin/pstat/pstat.c
+++ b/usr.sbin/pstat/pstat.c
@@ -718,7 +718,7 @@ ttymode(void)
 	int error;
 	size_t len, i;
 
-	printf(hdr);
+	printf("%s", hdr);
 	len = sizeof(ttyb);
 	error = sysctlbyname("kern.ttys", &ttyb, &len, 0, 0);
 	if (!error) {
@@ -762,7 +762,7 @@ ttytype(struct tty *tty, const char *name, int type, int number, int indir)
 		KGET1(type, tty, (ssize_t)(ntty * sizeof(struct tty)),
 		      "tty structs");
 	}
-	printf(hdr);
+	printf("%s", hdr);
 	for (tp = tty; tp < &tty[ntty]; tp++)
 		ttyprt(tp, tp - tty);
 }
-- 
1.8.2.2

