changeset 1563:3d32f9523584

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.
author Rob Landley <rob@landley.net>
date Wed, 19 Nov 2014 14:29:53 -0600
parents b5968bffb65c
children 685a0da6ca59
files toys/posix/tail.c
diffstat 1 files changed, 1 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/toys/posix/tail.c	Tue Nov 18 04:25:27 2014 -0600
+++ b/toys/posix/tail.c	Wed Nov 19 14:29:53 2014 -0600
@@ -164,6 +164,7 @@
           }
           list->data += bytes;
           list->len -= bytes;
+          bytes = 0;
         }
       } else {
         int len = new->len, count;