diff options
author | Rob Landley <rob@landley.net> | 2014-11-19 14:29:53 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2014-11-19 14:29:53 -0600 |
commit | 159a7f1621eecf6cf3c2824ffb762a19bf5f7667 (patch) | |
tree | 24eaecf6bab6f36522033b8c4e47c8d84fb43ac6 | |
parent | 45bd6a2cd43ebd27e2696852959617704a8faafd (diff) | |
download | toybox-159a7f1621eecf6cf3c2824ffb762a19bf5f7667.tar.gz |
Fix "tail -c 10" segfault spotted by Lukasz Szpakowski.
Once we've read through the initial TT.bytes backlog we discard the extra data,
meaning we adjust the remaining amount each time so the overflow is zero bytes.
We were doing the adjustment right, but not zeroing out the overflow counter
after we did so.
-rw-r--r-- | toys/posix/tail.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/toys/posix/tail.c b/toys/posix/tail.c index aba53180..e92c0446 100644 --- a/toys/posix/tail.c +++ b/toys/posix/tail.c @@ -164,6 +164,7 @@ static void do_tail(int fd, char *name) } list->data += bytes; list->len -= bytes; + bytes = 0; } } else { int len = new->len, count; |