about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/builtin.c3
2 files changed, 6 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index e44e2f08d..446d732d3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2019-05-14  Oliver Kiddle  <okiddle@yahoo.co.uk>
+
+	* 44291: Src/builtin.c: printf with argument specifier out of
+	range for an int crashed the shell.
+
 2019-05-14  Peter Stephenson  <p.stephenson@samsung.com>
 
 	* 44296: Src/parse.c, Test/B02typeset.ztst: "typeset Q= {X}"
diff --git a/Src/builtin.c b/Src/builtin.c
index 49f017046..5fbb86635 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -4993,8 +4993,7 @@ bin_print(char *name, char **args, Options ops, int func)
 	    	narg = strtoul(c, &endptr, 0);
 		if (*endptr == '$') {
 		    c = endptr + 1;
-		    DPUTS(narg <= 0, "specified zero or negative arg");
-		    if (narg > argc) {
+		    if (narg <= 0 || narg > argc) {
 		    	zwarnnam(name, "%d: argument specifier out of range",
 				 narg);
 			if (fout != stdout)