* checking whether cdb->len == 0 was missing as abort precondition
authorWilfried Göesgens <willi@citadel.org>
Wed, 27 Jan 2010 23:23:58 +0000 (23:23 +0000)
committerWilfried Göesgens <willi@citadel.org>
Wed, 27 Jan 2010 23:23:58 +0000 (23:23 +0000)
citadel/database.c

index 4c049f60e86edd77653566d72234290adc6ab613..ed9019288534c18f594f325eef25f0c45fb42d6b 100644 (file)
@@ -491,12 +491,11 @@ void cdb_decompress_if_necessary(struct cdbdata *cdb)
 {
        static int magic = COMPRESS_MAGIC;
 
-       if (cdb == NULL)
-               return;
-       if (cdb->ptr == NULL)
-               return;
-       if (memcmp(cdb->ptr, &magic, sizeof(magic)))
-               return;
+       if ((cdb == NULL) || 
+           (cdb->ptr == NULL) || 
+           (cdb->len == 0) ||
+           (memcmp(cdb->ptr, &magic, sizeof(magic))))
+           return;
 
 #ifdef HAVE_ZLIB
        /* At this point we know we're looking at a compressed item. */