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 812b32f..a67d85e 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;