From d66fd7fcf503b0b8a96b9aafc7263de9886a661e Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Tue, 14 May 2019 23:18:32 +0200 Subject: 44291: printf with argument specifier out of range for an int crashed the shell --- Src/builtin.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Src') 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) -- cgit 1.4.1