summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhalex <halex@openbsd.org>2016-02-03 12:23:57 +0000
committerhalex <halex@openbsd.org>2016-02-03 12:23:57 +0000
commitc106da0b115582acea79530641beb6731de7c211 (patch)
tree4e525ca1ed90e34bc2f9da9d462b7ea184668d67
parenttell filters to rollback the current transaction if MAIL or EOM fails (diff)
downloadwireguard-openbsd-c106da0b115582acea79530641beb6731de7c211.tar.xz
wireguard-openbsd-c106da0b115582acea79530641beb6731de7c211.zip
fix off-by-one in argument parsing
ok martijn@
-rw-r--r--usr.bin/tail/tail.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/tail/tail.c b/usr.bin/tail/tail.c
index 0d66b83e54f..8319062c500 100644
--- a/usr.bin/tail/tail.c
+++ b/usr.bin/tail/tail.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tail.c,v 1.20 2015/11/19 17:50:04 tedu Exp $ */
+/* $OpenBSD: tail.c,v 1.21 2016/02/03 12:23:57 halex Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -153,7 +153,8 @@ main(int argc, char *argv[])
err(1, "reallocarray");
if (argc) {
- for (i = 0; (tf[i].fname = *argv++); i++) {
+ for (i = 0; *argv; i++) {
+ tf[i].fname = *argv++;
if ((tf[i].fp = fopen(tf[i].fname, "r")) == NULL ||
fstat(fileno(tf[i].fp), &(tf[i].sb))) {
ierr(tf[i].fname);