1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-11-02 06:40:55 +01:00

44291: printf with argument specifier out of range for an int crashed the shell

This commit is contained in:
Oliver Kiddle 2019-05-14 23:18:32 +02:00
parent 30e356eb1a
commit d66fd7fcf5
2 changed files with 6 additions and 2 deletions

View file

@ -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)