X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fdatabase.c;h=ed9019288534c18f594f325eef25f0c45fb42d6b;hb=8cb1e443d6b223fee1e510b388d82376706210c5;hp=4c049f60e86edd77653566d72234290adc6ab613;hpb=dcf99fe61379b78436c387ea3f89ebfd4ffaf635;p=citadel.git 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. */