projects
/
platform
/
upstream
/
toybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
45b3882
)
Fix use after free error spotted by ?ukasz Szpakowski.
author
Rob Landley
<rob@landley.net>
Tue, 28 Oct 2014 00:20:31 +0000
(19:20 -0500)
committer
Rob Landley
<rob@landley.net>
Tue, 28 Oct 2014 00:20:31 +0000
(19:20 -0500)
toys/posix/tail.c
patch
|
blob
|
history
diff --git
a/toys/posix/tail.c
b/toys/posix/tail.c
index
e1048be
..
aba5318
100644
(file)
--- a/
toys/posix/tail.c
+++ b/
toys/posix/tail.c
@@
-176,9
+176,13
@@
static void do_tail(int fd, char *name)
linepop = try[count] == '\n';
if (lines > 0) {
+ char c;
+
do {
+ c = *list->data;
if (!--(list->len)) free(dlist_pop(&list));
- } while (*(list->data++) != '\n');
+ else list->data++;
+ } while (c != '\n');
lines--;
}
}