From: Thomas Hindoe Paaboel Andersen Date: Thu, 12 Jun 2014 20:50:04 +0000 (+0200) Subject: cryptsetup: check that password is not null X-Git-Tag: v215~473 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=f268f57f6344d3a2ccf447352ff3ed1313c4a199 cryptsetup: check that password is not null Beef up the assert to protect against passing null to strlen. Found with scan-build. --- diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c index 812b32f6c..a67d85e62 100644 --- a/src/cryptsetup/cryptsetup.c +++ b/src/cryptsetup/cryptsetup.c @@ -344,7 +344,7 @@ static int attach_tcrypt(struct crypt_device *cd, assert(cd); assert(name); - assert(key_file || passwords); + assert(key_file || (passwords && passwords[0])); if (arg_tcrypt_hidden) params.flags |= CRYPT_TCRYPT_HIDDEN_HEADER;