Module Name:    src
Committed By:   joerg
Date:           Sun Oct 16 17:12:11 UTC 2011

Modified Files:
        src/bin/ksh: Makefile c_ksh.c exec.c expr.c jobs.c lex.c main.c misc.c
            var.c

Log Message:
Don't use non-literal format strings.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/bin/ksh/Makefile
cvs rdiff -u -r1.17 -r1.18 src/bin/ksh/c_ksh.c
cvs rdiff -u -r1.13 -r1.14 src/bin/ksh/exec.c
cvs rdiff -u -r1.8 -r1.9 src/bin/ksh/expr.c
cvs rdiff -u -r1.9 -r1.10 src/bin/ksh/jobs.c
cvs rdiff -u -r1.14 -r1.15 src/bin/ksh/lex.c src/bin/ksh/main.c \
    src/bin/ksh/misc.c
cvs rdiff -u -r1.16 -r1.17 src/bin/ksh/var.c

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

Modified files:

Index: src/bin/ksh/Makefile
diff -u src/bin/ksh/Makefile:1.29 src/bin/ksh/Makefile:1.30
--- src/bin/ksh/Makefile:1.29	Sun Aug 14 10:40:25 2011
+++ src/bin/ksh/Makefile	Sun Oct 16 17:12:11 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.29 2011/08/14 10:40:25 christos Exp $
+#	$NetBSD: Makefile,v 1.30 2011/10/16 17:12:11 joerg Exp $
 
 WARNS=3
 
@@ -47,6 +47,4 @@ ksh.1: ksh.Man mkman
 	${HOST_SH} $(.CURDIR)/mkman ksh $(.CURDIR)/ksh.Man >ksh.1.tmp \
 	    && mv ksh.1.tmp ksh.1
 
-CWARNFLAGS.clang+=	-Wno-format-security
-
 .include <bsd.prog.mk>

Index: src/bin/ksh/c_ksh.c
diff -u src/bin/ksh/c_ksh.c:1.17 src/bin/ksh/c_ksh.c:1.18
--- src/bin/ksh/c_ksh.c:1.17	Wed Aug 31 16:24:54 2011
+++ src/bin/ksh/c_ksh.c	Sun Oct 16 17:12:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_ksh.c,v 1.17 2011/08/31 16:24:54 plunky Exp $	*/
+/*	$NetBSD: c_ksh.c,v 1.18 2011/10/16 17:12:11 joerg Exp $	*/
 
 /*
  * built-in Korn commands: c_*
@@ -6,7 +6,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: c_ksh.c,v 1.17 2011/08/31 16:24:54 plunky Exp $");
+__RCSID("$NetBSD: c_ksh.c,v 1.18 2011/10/16 17:12:11 joerg Exp $");
 #endif
 
 #include "sh.h"
@@ -573,7 +573,7 @@ c_whence(wp)
 			break;
 		}
 		if (vflag || !ret)
-			shprintf(newline);
+			shprintf("%s", newline);
 	}
 	return ret;
 }
@@ -873,7 +873,7 @@ c_typeset(wp)
 				else
 				    print_value_quoted(s);
 			    }
-			    shprintf(newline);
+			    shprintf("%s", newline);
 			}
 			/* Only report first `element' of an array with
 			 * no set elements.
@@ -964,7 +964,7 @@ c_alias(wp)
 					shf_putc('=', shl_stdout);
 					print_value_quoted(ap->val.s);
 				}
-				shprintf(newline);
+				shprintf("%s", newline);
 			}
 	}
 
@@ -988,7 +988,7 @@ c_alias(wp)
 					shf_putc('=', shl_stdout);
 					print_value_quoted(ap->val.s);
 				}
-				shprintf(newline);
+				shprintf("%s", newline);
 			} else {
 				shprintf("%s alias not found\n", alias);
 				rv = 1;
@@ -1236,7 +1236,7 @@ c_kill(wp)
 "usage: kill [ -s signame | -signum | -signame ] {pid|job}...\n\
        kill -l [exit_status]\n"
 			);
-		bi_errorf(null);
+		bi_errorf("%s", null);
 		return 1;
 	}
 
@@ -1257,7 +1257,7 @@ c_kill(wp)
 			for (i = 1; i < SIGNALS; i++, p = space)
 				if (sigtraps[i].name)
 					shprintf("%s%s", p, sigtraps[i].name);
-			shprintf(newline);
+			shprintf("%s", newline);
 		} else {
 			int w, si;
 			int mess_width;

Index: src/bin/ksh/exec.c
diff -u src/bin/ksh/exec.c:1.13 src/bin/ksh/exec.c:1.14
--- src/bin/ksh/exec.c:1.13	Mon Apr 24 19:58:20 2006
+++ src/bin/ksh/exec.c	Sun Oct 16 17:12:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.13 2006/04/24 19:58:20 christos Exp $	*/
+/*	$NetBSD: exec.c,v 1.14 2011/10/16 17:12:11 joerg Exp $	*/
 
 /*
  * execute command tree
@@ -6,7 +6,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: exec.c,v 1.13 2006/04/24 19:58:20 christos Exp $");
+__RCSID("$NetBSD: exec.c,v 1.14 2011/10/16 17:12:11 joerg Exp $");
 #endif
 
 
@@ -151,7 +151,7 @@ execute(t, flags)
 				 */
 				if (tp && tp->type == CSHELL
 				    && (tp->flag & SPEC_BI))
-					errorf(null);
+					errorf("%s", null);
 				/* Deal with FERREXIT, quitenv(), etc. */
 				goto Break;
 			}

Index: src/bin/ksh/expr.c
diff -u src/bin/ksh/expr.c:1.8 src/bin/ksh/expr.c:1.9
--- src/bin/ksh/expr.c:1.8	Sun Jun 26 19:09:00 2005
+++ src/bin/ksh/expr.c	Sun Oct 16 17:12:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: expr.c,v 1.8 2005/06/26 19:09:00 christos Exp $	*/
+/*	$NetBSD: expr.c,v 1.9 2011/10/16 17:12:11 joerg Exp $	*/
 
 /*
  * Korn expression evaluation
@@ -9,7 +9,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: expr.c,v 1.8 2005/06/26 19:09:00 christos Exp $");
+__RCSID("$NetBSD: expr.c,v 1.9 2011/10/16 17:12:11 joerg Exp $");
 #endif
 
 
@@ -193,7 +193,7 @@ v_evaluate(vp, expr, error_ok)
 		if (i == LAEXPR) {
 			if (error_ok == KSH_RETURN_ERROR)
 				return 0;
-			errorf(null);
+			errorf("%s", null);
 		}
 		unwind(i);
 		/*NOTREACHED*/

Index: src/bin/ksh/jobs.c
diff -u src/bin/ksh/jobs.c:1.9 src/bin/ksh/jobs.c:1.10
--- src/bin/ksh/jobs.c:1.9	Sat Feb 25 00:58:34 2006
+++ src/bin/ksh/jobs.c	Sun Oct 16 17:12:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: jobs.c,v 1.9 2006/02/25 00:58:34 wiz Exp $	*/
+/*	$NetBSD: jobs.c,v 1.10 2011/10/16 17:12:11 joerg Exp $	*/
 
 /*
  * Process and job control
@@ -26,7 +26,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: jobs.c,v 1.9 2006/02/25 00:58:34 wiz Exp $");
+__RCSID("$NetBSD: jobs.c,v 1.10 2011/10/16 17:12:11 joerg Exp $");
 #endif
 
 
@@ -900,7 +900,7 @@ j_resume(cp, bg)
 		}
 		shprintf("%s%s", p->command, p->next ? "| " : null);
 	}
-	shprintf(newline);
+	shprintf("%s", newline);
 	shf_flush(shl_stdout);
 	if (running)
 		j->state = PRUNNING;

Index: src/bin/ksh/lex.c
diff -u src/bin/ksh/lex.c:1.14 src/bin/ksh/lex.c:1.15
--- src/bin/ksh/lex.c:1.14	Sun Jan 23 17:15:15 2011
+++ src/bin/ksh/lex.c	Sun Oct 16 17:12:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: lex.c,v 1.14 2011/01/23 17:15:15 hauke Exp $	*/
+/*	$NetBSD: lex.c,v 1.15 2011/10/16 17:12:11 joerg Exp $	*/
 
 /*
  * lexical analysis and source input
@@ -6,7 +6,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: lex.c,v 1.14 2011/01/23 17:15:15 hauke Exp $");
+__RCSID("$NetBSD: lex.c,v 1.15 2011/10/16 17:12:11 joerg Exp $");
 #endif
 
 
@@ -861,7 +861,7 @@ yyerror(fmt, va_alist)
 	SH_VA_START(va, fmt);
 	shf_vfprintf(shl_out, fmt, va);
 	va_end(va);
-	errorf(null);
+	errorf("%s", null);
 }
 
 /*
Index: src/bin/ksh/main.c
diff -u src/bin/ksh/main.c:1.14 src/bin/ksh/main.c:1.15
--- src/bin/ksh/main.c:1.14	Sun Jun 24 18:00:49 2007
+++ src/bin/ksh/main.c	Sun Oct 16 17:12:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.14 2007/06/24 18:00:49 christos Exp $	*/
+/*	$NetBSD: main.c,v 1.15 2011/10/16 17:12:11 joerg Exp $	*/
 
 /*
  * startup, main loop, environments and error handling
@@ -7,7 +7,7 @@
 #include <locale.h>
 
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.14 2007/06/24 18:00:49 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.15 2011/10/16 17:12:11 joerg Exp $");
 #endif
 
 
@@ -565,7 +565,7 @@ shell(s, toplevel)
 		  case LSHELL:
 			if (interactive) {
 				if (i == LINTR)
-					shellf(newline);
+					shellf("%s", newline);
 				/* Reset any eof that was read as part of a
 				 * multiline command.
 				 */
@@ -864,6 +864,6 @@ aerror(ap, msg)
 	const char *msg;
 {
 	internal_errorf(1, "alloc: %s", msg);
-	errorf(null); /* this is never executed - keeps gcc quiet */
+	errorf("%s", null); /* this is never executed - keeps gcc quiet */
 	/*NOTREACHED*/
 }
Index: src/bin/ksh/misc.c
diff -u src/bin/ksh/misc.c:1.14 src/bin/ksh/misc.c:1.15
--- src/bin/ksh/misc.c:1.14	Thu Oct 22 15:53:19 2009
+++ src/bin/ksh/misc.c	Sun Oct 16 17:12:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: misc.c,v 1.14 2009/10/22 15:53:19 seanb Exp $	*/
+/*	$NetBSD: misc.c,v 1.15 2011/10/16 17:12:11 joerg Exp $	*/
 
 /*
  * Miscellaneous functions
@@ -6,7 +6,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: misc.c,v 1.14 2009/10/22 15:53:19 seanb Exp $");
+__RCSID("$NetBSD: misc.c,v 1.15 2011/10/16 17:12:11 joerg Exp $");
 #endif
 
 
@@ -265,7 +265,7 @@ printoptions(verbose)
 		for (i = 0; i < (int)NELEM(goptions); i++)
 			if (Flag(i) && goptions[i].name)
 				shprintf(" -o %s", goptions[i].name);
-		shprintf(newline);
+		shprintf("%s", newline);
 	}
 }
 
@@ -1011,7 +1011,7 @@ ksh_getopt(argv, go, options)
 				(go->flags & GF_NONAME) ? "" : argv[0],
 				(go->flags & GF_NONAME) ? "" : ": ", c);
 			if (go->flags & GF_ERROR)
-				bi_errorf(null);
+				bi_errorf("%s", null);
 		}
 		return '?';
 	}
@@ -1037,7 +1037,7 @@ ksh_getopt(argv, go, options)
 				(go->flags & GF_NONAME) ? "" : argv[0],
 				(go->flags & GF_NONAME) ? "" : ": ", c);
 			if (go->flags & GF_ERROR)
-				bi_errorf(null);
+				bi_errorf("%s", null);
 			return '?';
 		}
 		go->p = 0;
@@ -1088,7 +1088,7 @@ print_value_quoted(s)
 	}
 	for (p = s; *p; p++) {
 		if (*p == '\'') {
-			shprintf("'\\'" + 1 - inquote);
+			shprintf("%s", "'\\'" + 1 - inquote);
 			inquote = 0;
 		} else {
 			if (!inquote) {

Index: src/bin/ksh/var.c
diff -u src/bin/ksh/var.c:1.16 src/bin/ksh/var.c:1.17
--- src/bin/ksh/var.c:1.16	Sun Oct 16 00:32:25 2011
+++ src/bin/ksh/var.c	Sun Oct 16 17:12:11 2011
@@ -1,9 +1,9 @@
-/*	$NetBSD: var.c,v 1.16 2011/10/16 00:32:25 reed Exp $	*/
+/*	$NetBSD: var.c,v 1.17 2011/10/16 17:12:11 joerg Exp $	*/
 
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: var.c,v 1.16 2011/10/16 00:32:25 reed Exp $");
+__RCSID("$NetBSD: var.c,v 1.17 2011/10/16 17:12:11 joerg Exp $");
 #endif
 
 
@@ -377,7 +377,7 @@ setstr(vq, s, error_ok)
 	if ((vq->flag & RDONLY) && !no_ro_check) {
 		warningf(TRUE, "%s: is read only", vq->name);
 		if (!error_ok)
-			errorf(null);
+			errorf("%s", null);
 		return 0;
 	}
 	if (!(vq->flag&INTEGER)) { /* string dest */
@@ -738,7 +738,7 @@ typeset(var, set, clr, field, base)
 			}
 		}
 		if (!ok)
-		    errorf(null);
+		    errorf("%s", null);
 	}
 
 	if (val != NULL) {

Reply via email to