diff options
author | 2013-12-18 13:53:11 +0000 | |
---|---|---|
committer | 2013-12-18 13:53:11 +0000 | |
commit | c84a373aa167f5a01efaf6c30f930ec8eb0d5f7d (patch) | |
tree | dc3949684564056179e0d6c749fabeff958e33d2 | |
parent | Revert the *other* part of bpf.c's r1.84. May finally fix RD Thrush's (diff) | |
download | wireguard-openbsd-c84a373aa167f5a01efaf6c30f930ec8eb0d5f7d.tar.xz wireguard-openbsd-c84a373aa167f5a01efaf6c30f930ec8eb0d5f7d.zip |
Remove artificial limit on the max array index.
Adapted from a bitrig commit from Martin Natano.
OK zhuk@
-rw-r--r-- | bin/ksh/ksh.1 | 5 | ||||
-rw-r--r-- | bin/ksh/sh.h | 3 | ||||
-rw-r--r-- | bin/ksh/var.c | 4 |
3 files changed, 5 insertions, 7 deletions
diff --git a/bin/ksh/ksh.1 b/bin/ksh/ksh.1 index f42cb1b6811..a3b018b86ee 100644 --- a/bin/ksh/ksh.1 +++ b/bin/ksh/ksh.1 @@ -1,8 +1,8 @@ -.\" $OpenBSD: ksh.1,v 1.148 2013/09/04 15:49:18 millert Exp $ +.\" $OpenBSD: ksh.1,v 1.149 2013/12/18 13:53:11 millert Exp $ .\" .\" Public Domain .\" -.Dd $Mdocdate: September 4 2013 $ +.Dd $Mdocdate: December 18 2013 $ .Dt KSH 1 .Os .Sh NAME @@ -1038,7 +1038,6 @@ form where .Ar expr is an arithmetic expression. -Array indices are currently limited to the range 0 through 10239, inclusive. Parameter substitutions take the form .Pf $ Ns Ar name , .Pf ${ Ns Ar name Ns } , diff --git a/bin/ksh/sh.h b/bin/ksh/sh.h index 153af5c368e..8a417a4785f 100644 --- a/bin/ksh/sh.h +++ b/bin/ksh/sh.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sh.h,v 1.32 2013/11/28 10:33:37 sobrado Exp $ */ +/* $OpenBSD: sh.h,v 1.33 2013/12/18 13:53:12 millert Exp $ */ /* * Public Domain Bourne/Korn shell @@ -68,7 +68,6 @@ typedef INT32 Tflag; #define LINE 2048 /* input line size */ #define PATH 1024 /* pathname size (todo: PATH_MAX/pathconf()) */ -#define ARRAYMAX (10*1024-1) /* max array index */ EXTERN const char *kshname; /* $0 */ EXTERN pid_t kshpid; /* $$, shell pid */ diff --git a/bin/ksh/var.c b/bin/ksh/var.c index ac2bf76b875..210181d5017 100644 --- a/bin/ksh/var.c +++ b/bin/ksh/var.c @@ -1,4 +1,4 @@ -/* $OpenBSD: var.c,v 1.36 2013/12/17 16:37:06 deraadt Exp $ */ +/* $OpenBSD: var.c,v 1.37 2013/12/18 13:53:12 millert Exp $ */ #include "sh.h" #include <time.h> @@ -142,7 +142,7 @@ array_index_calc(const char *n, bool *arrayp, int *valp) afree(tmp, ATEMP); n = str_nsave(n, p - n, ATEMP); evaluate(sub, &rval, KSH_UNWIND_ERROR, true); - if (rval < 0 || rval > ARRAYMAX) + if (rval < 0 || rval > INT_MAX) errorf("%s: subscript %ld out of range", n, rval); *valp = rval; afree(sub, ATEMP); |