chiark / gitweb /
cryptsetup: check that password is not null
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Thu, 12 Jun 2014 20:50:04 +0000 (22:50 +0200)
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Thu, 12 Jun 2014 22:30:40 +0000 (00:30 +0200)
Beef up the assert to protect against passing null to strlen.

Found with scan-build.

src/cryptsetup/cryptsetup.c

index 812b32f6cab2e140635e8ca362da817653cd5535..a67d85e623c685a0ac96e7d0df3d7c8b39b2713e 100644 (file)
@@ -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;