]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(two_arguments): Don't test argv[pos][2] if it's past end of string.
authorJim Meyering <jim@meyering.net>
Tue, 26 May 1998 13:36:49 +0000 (13:36 +0000)
committerJim Meyering <jim@meyering.net>
Tue, 26 May 1998 13:36:49 +0000 (13:36 +0000)
src/test.c

index 28059aab82f8c7bf467492a87d84fa42e0c3569c..0ea0abb58ec63058d9727f8cb12159bc19e34726 100644 (file)
@@ -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 ();