aboutsummaryrefslogtreecommitdiff
path: root/coreutils/tail.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-03-28 16:54:14 +0000
committerEric Andersen <andersen@codepoet.org>2003-03-28 16:54:14 +0000
commitb5b5ac32372c19b0776dceec67c9ed876b8616d3 (patch)
treeea1b896f1e2ed6781e8f30cad0e24ce3d62f4b74 /coreutils/tail.c
parenta0f0f0cf76458ed2e2cb6cb5fe5425bd7322775d (diff)
downloadbusybox-w32-b5b5ac32372c19b0776dceec67c9ed876b8616d3.tar.gz
busybox-w32-b5b5ac32372c19b0776dceec67c9ed876b8616d3.tar.bz2
busybox-w32-b5b5ac32372c19b0776dceec67c9ed876b8616d3.zip
trivial fix to make sure we have sufficient arguments before
we mess with a possibly non-existant argv[1] -Erik
Diffstat (limited to 'coreutils/tail.c')
-rw-r--r--coreutils/tail.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/coreutils/tail.c b/coreutils/tail.c
index 8e0adf5b5..10b5cd7a7 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
@@ -118,11 +118,10 @@ int tail_main(int argc, char **argv)
118 const char *fmt; 118 const char *fmt;
119 119
120 /* Allow legacy syntax of an initial numeric option without -n. */ 120 /* Allow legacy syntax of an initial numeric option without -n. */
121 if ((argv[1][0] == '+') 121 if (argc >=2 && ((argv[1][0] == '+') || ((argv[1][0] == '-')
122 || ((argv[1][0] == '-')
123 /* && (isdigit)(argv[1][1]) */ 122 /* && (isdigit)(argv[1][1]) */
124 && (((unsigned int)(argv[1][1] - '0')) <= 9)) 123 && (((unsigned int)(argv[1][1] - '0')) <= 9))))
125 ) { 124 {
126 optind = 2; 125 optind = 2;
127 optarg = argv[1]; 126 optarg = argv[1];
128 goto GET_COUNT; 127 goto GET_COUNT;