fc without arguments dereferences argv[1]; from Christos
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Tue, 1 Dec 1992 16:34:56 +0000 (08:34 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Tue, 1 Dec 1992 16:34:56 +0000 (08:34 -0800)
SCCS-vsn: bin/sh/histedit.c 5.1

usr/src/bin/sh/histedit.c

index a2ab153..1143ad9 100644 (file)
@@ -130,6 +130,9 @@ histcmd(argc, argv)
 
        if (hist == NULL)
                error("history not active");
 
        if (hist == NULL)
                error("history not active");
+       
+       if (argc == 1)
+               error("missing history argument");
 
        optreset = 1; optind = 1; /* initialize getopt */
        while (not_fcnumber(argv[optind]) &&
 
        optreset = 1; optind = 1; /* initialize getopt */
        while (not_fcnumber(argv[optind]) &&