diff options
author | Jim Meyering <jim@meyering.net> | 1998-05-26 13:36:49 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1998-05-26 13:36:49 +0000 |
commit | 9e1c89c38ef83288ea418fe69847514a803d0777 (patch) | |
tree | 61ba768ba605ccc21002d35676e18a87e71aed3d /src | |
parent | c726bc570993824bde411e112728d4530a389f6b (diff) | |
download | coreutils-9e1c89c38ef83288ea418fe69847514a803d0777.tar.xz |
(two_arguments): Don't test argv[pos][2] if it's past end of string.
Diffstat (limited to 'src')
-rw-r--r-- | src/test.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/test.c b/src/test.c index 28059aab8..0ea0abb58 100644 --- a/src/test.c +++ b/src/test.c @@ -2,7 +2,7 @@ /* Modified to run with the GNU shell by bfox. */ -/* Copyright (C) 1987-1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1987-1996, 1997, 1998 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -880,7 +880,9 @@ two_arguments (void) if (STREQ (argv[pos], "!")) value = strlen (argv[pos+1]) == 0; - else if ((argv[pos][0] == '-') && (argv[pos][2] == '\0')) + else if (argv[pos][0] == '-' + && argv[pos][1] != '\0' + && argv[pos][2] == '\0') { if (unop (argv[pos][1])) value = unary_operator (); |