From: Martin Mares Date: Wed, 7 Mar 2001 12:34:14 +0000 (+0000) Subject: Don't crash when the last fragment is of zero length. X-Git-Tag: holmes-import~1522 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=b1cd4b4205cec5683827f81adaba7d8d8779a3a2;p=libucw.git Don't crash when the last fragment is of zero length. No more SEGV's on truncated files. --- diff --git a/lib/fb-mem.c b/lib/fb-mem.c index 54fe8bfa..d5e6e8b9 100644 --- a/lib/fb-mem.c +++ b/lib/fb-mem.c @@ -46,6 +46,8 @@ fbmem_refill(struct fastbuf *f) f->pos += b->size; b = b->next; } + if (!b->size) + return 0; f->buffer = f->bptr = b->data; f->bufend = f->bstop = b->data + b->size; f->llpos = b;