Mercurial > hg > toybox
comparison toys/posix/tail.c @ 1563:3d32f9523584 draft
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 | 1d996b0a11c0 |
children | fa8f0a5dfc11 |
comparison
equal
deleted
inserted
replaced
1562:b5968bffb65c | 1563:3d32f9523584 |
---|---|
162 bytes -= list->len; | 162 bytes -= list->len; |
163 free(dlist_pop(&list)); | 163 free(dlist_pop(&list)); |
164 } | 164 } |
165 list->data += bytes; | 165 list->data += bytes; |
166 list->len -= bytes; | 166 list->len -= bytes; |
167 bytes = 0; | |
167 } | 168 } |
168 } else { | 169 } else { |
169 int len = new->len, count; | 170 int len = new->len, count; |
170 char *try = new->data; | 171 char *try = new->data; |
171 | 172 |