diff options
author | 1998-01-17 19:00:44 +0000 | |
---|---|---|
committer | 1998-01-17 19:00:44 +0000 | |
commit | cdffab64516bded5437df67341dd668842032181 (patch) | |
tree | 30b4d43bc20f472dac7e3427a99b4003b891c601 | |
parent | Don't document ulimit flags that don't exist (diff) | |
download | wireguard-openbsd-cdffab64516bded5437df67341dd668842032181.tar.xz wireguard-openbsd-cdffab64516bded5437df67341dd668842032181.zip |
Make ulimit catch bogosity so that: "ulimit -dflmnpst unlimitted"
Results in: ksh: ulimit: "unlimitted" is not a valid limit
Not: Killed (because it treated the word as 0).
Noticed by mickey@openbsd.org
-rw-r--r-- | bin/ksh/c_ulimit.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/bin/ksh/c_ulimit.c b/bin/ksh/c_ulimit.c index b96c10bf5b8..deb26986fc8 100644 --- a/bin/ksh/c_ulimit.c +++ b/bin/ksh/c_ulimit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: c_ulimit.c,v 1.3 1997/06/19 13:58:39 kstailey Exp $ */ +/* $OpenBSD: c_ulimit.c,v 1.4 1998/01/17 19:00:44 millert Exp $ */ /* ulimit -- handle "ulimit" builtin @@ -167,7 +167,10 @@ c_ulimit(wp) val = RLIM_INFINITY; else #endif /* RLIM_INFINITY */ - { + if (!isdigit(*p)) { + bi_errorf("\"%s\" is not a valid limit", p); + return 1; + } else { long rval; if (!evaluate(p, &rval, TRUE)) |