mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-17 05:40:13 +01:00
Fix malloc of 0 size.
This commit is contained in:
@@ -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);
|
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;
|
return -ENOMEM;
|
||||||
memset(buf, 0, size);
|
memset(buf, 0, size);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user