From: Wilfried Göesgens Date: Wed, 27 Jan 2010 23:23:58 +0000 (+0000) Subject: * checking whether cdb->len == 0 was missing as abort precondition X-Git-Tag: v7.86~477 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=8cb1e443d6b223fee1e510b388d82376706210c5 * checking whether cdb->len == 0 was missing as abort precondition --- diff --git a/citadel/database.c b/citadel/database.c index 4c049f60e..ed9019288 100644 --- a/citadel/database.c +++ b/citadel/database.c @@ -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. */