diff options
Diffstat (limited to 'bin/sh/expand.c')
-rw-r--r-- | bin/sh/expand.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/sh/expand.c b/bin/sh/expand.c index b8ef5ea..15afc9c 100644 --- a/bin/sh/expand.c +++ b/bin/sh/expand.c @@ -846,9 +846,11 @@ varisset(const char *name, int nulok) } } else if (is_digit(*name)) { char *ap; - int num = atoi(name); + long num; - if (num > shellparam.nparam) + errno = 0; + num = strtol(name, NULL, 10); + if (errno != 0 || num > shellparam.nparam) return 0; if (num == 0) |