[BusyBox-cvs] busybox/coreutils tail.c,1.44,1.45

Erik Andersen andersen at codepoet.org
Fri Mar 28 16:54:18 UTC 2003


Update of /var/cvs/busybox/coreutils
In directory winder:/tmp/cvs-serv29663

Modified Files:
	tail.c 
Log Message:
trivial fix to make sure we have sufficient arguments before
we mess with a possibly non-existant argv[1]
 -Erik


Index: tail.c
===================================================================
RCS file: /var/cvs/busybox/coreutils/tail.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- tail.c	19 Mar 2003 09:11:34 -0000	1.44
+++ tail.c	28 Mar 2003 16:54:14 -0000	1.45
@@ -118,11 +118,10 @@
 	const char *fmt;
 
 	/* Allow legacy syntax of an initial numeric option without -n. */
-	if ((argv[1][0] == '+')
-		|| ((argv[1][0] == '-')
+	if (argc >=2 && ((argv[1][0] == '+') || ((argv[1][0] == '-')
 			/* && (isdigit)(argv[1][1]) */
-			&& (((unsigned int)(argv[1][1] - '0')) <= 9))
-		) {
+			&& (((unsigned int)(argv[1][1] - '0')) <= 9)))) 
+	{
 		optind = 2;
 		optarg = argv[1];
 		goto GET_COUNT;




More information about the busybox-cvs mailing list