]> mj.ucw.cz Git - libucw.git/commitdiff
Don't crash when the last fragment is of zero length.
authorMartin Mares <mj@ucw.cz>
Wed, 7 Mar 2001 12:34:14 +0000 (12:34 +0000)
committerMartin Mares <mj@ucw.cz>
Wed, 7 Mar 2001 12:34:14 +0000 (12:34 +0000)
No more SEGV's on truncated files.

lib/fb-mem.c

index 54fe8bfad74a646268ce70eb75f52fc167842315..d5e6e8b96f4e54bfd4b70fd4d6ae02849a7e8849 100644 (file)
@@ -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;