From: Milan Broz Date: Mon, 18 Jun 2012 13:03:47 +0000 (+0200) Subject: Fix malloc of 0 size. X-Git-Tag: upstream/1.6~239 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fupstream%2Fcryptsetup.git;a=commitdiff_plain;h=e37016bf649adb19e649da494e5ebea9183f33b9 Fix malloc of 0 size. --- diff --git a/src/cryptsetup_reencrypt.c b/src/cryptsetup_reencrypt.c index f5f33da..fa6ce13 100644 --- a/src/cryptsetup_reencrypt.c +++ b/src/cryptsetup_reencrypt.c @@ -317,7 +317,7 @@ static int create_empty_header(const char *new_file, const char *old_file, log_dbg("Creating empty file %s of size %lu.", new_file, (unsigned long)size); - if (!(buf = malloc(size))) + if (!size || !(buf = malloc(size))) return -ENOMEM; memset(buf, 0, size);