From 8cb1e443d6b223fee1e510b388d82376706210c5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Wed, 27 Jan 2010 23:23:58 +0000 Subject: [PATCH] * checking whether cdb->len == 0 was missing as abort precondition --- citadel/database.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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. */ -- 2.30.2