projects
/
oweals
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a0f0f0c
)
trivial fix to make sure we have sufficient arguments before
author
Eric Andersen
<andersen@codepoet.org>
Fri, 28 Mar 2003 16:54:14 +0000
(16:54 -0000)
committer
Eric Andersen
<andersen@codepoet.org>
Fri, 28 Mar 2003 16:54:14 +0000
(16:54 -0000)
we mess with a possibly non-existant argv[1]
-Erik
coreutils/tail.c
patch
|
blob
|
history
diff --git
a/coreutils/tail.c
b/coreutils/tail.c
index 8e0adf5b5c5e927ee71a8c40450bee962be875f8..10b5cd7a7d120c3a38351827e50ae35a64d232cf 100644
(file)
--- a/
coreutils/tail.c
+++ b/
coreutils/tail.c
@@
-118,11
+118,10
@@
int tail_main(int argc, char **argv)
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;