[PATCH] fix segfault in fsck-cache
[gitweb.git] / sha1_file.c
index 97a515a073fec5870dfaaa279868ce9330853d3d..28ad1598e54200ca8ee1261ed7beb4e31e20b2f1 100644 (file)
@@ -155,6 +155,8 @@ void * unpack_sha1_file(void *map, unsigned long mapsize, char *type, unsigned l
 
        inflateInit(&stream);
        ret = inflate(&stream, 0);
+       if (ret < Z_OK)
+               return NULL;
        if (sscanf(buffer, "%10s %lu", type, size) != 2)
                return NULL;