diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-02-01 02:15:02 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-02-01 02:15:02 +0000 |
commit | 99e16f56c85c187bdae2e50387ef0e7f44817af1 (patch) | |
tree | c98cf5a9315678724c99fe4e3adcb57d969d6c64 | |
parent | f7e4cf6cd46aa509e565a3739beada3c526da7ec (diff) |
avoid SEGV on out-of-range argument reference ("echo $020129163642").
-rw-r--r-- | bin/csh/dol.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/bin/csh/dol.c b/bin/csh/dol.c index 7ce3cd3fee2..fd6ce9b1f53 100644 --- a/bin/csh/dol.c +++ b/bin/csh/dol.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dol.c,v 1.6 2001/06/25 04:41:25 art Exp $ */ +/* $OpenBSD: dol.c,v 1.7 2002/02/01 02:15:01 itojun Exp $ */ /* $NetBSD: dol.c,v 1.8 1995/09/27 00:38:38 jtc Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)dol.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: dol.c,v 1.6 2001/06/25 04:41:25 art Exp $"; +static char rcsid[] = "$OpenBSD: dol.c,v 1.7 2002/02/01 02:15:01 itojun Exp $"; #endif #endif /* not lint */ @@ -490,10 +490,8 @@ Dgetdol() c = DgetC(0); } while (Isdigit(c)); unDredc(c); - if (subscr < 0) { - dolerror(vp->v_name); - return; - } + if (subscr < 0) + stderror(ERR_RANGE); if (subscr == 0) { if (bitset) { dolp = ffile ? STR1 : STR0; |