]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(main): Don't overrun array bound if argc is 0.
authorJim Meyering <jim@meyering.net>
Fri, 9 May 2003 08:50:37 +0000 (08:50 +0000)
committerJim Meyering <jim@meyering.net>
Fri, 9 May 2003 08:50:37 +0000 (08:50 +0000)
That would happen when invoked via: execl ("/usr/bin/sort", NULL);

src/sort.c

index ede496026875ba7b06b8e3f3cc9b04f3a2e8aa66..0357c8e337fabd794f01905039409a3c0335e634 100644 (file)
@@ -2265,7 +2265,7 @@ main (int argc, char **argv)
                                long_options, NULL))
              == -1))
        {
-         if (optind == argc)
+         if (argc < optind)
            break;
          files[nfiles++] = argv[optind++];
        }