From: Thomas Hindoe Paaboel Andersen <pho...@gmail.com>

Beef up the assert to protect against passing null to strlen.

Found with scan-build.
---
 src/cryptsetup/cryptsetup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index 812b32f..a67d85e 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;
-- 
1.9.3

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to