Allow empty passphrases when opening BitLocker devices

It's probably not possible to create a BitLocker device with an
empty passphrase but we want to support it. And it's definitely
better to ask for the passphrase again instead of returning
ENOMEM.
This commit is contained in:
Vojtěch Trefný
2019-11-21 17:41:15 +01:00
committed by Milan Broz
parent 2fbf5cd79f
commit 5ec2fbcd38

View File

@@ -227,6 +227,9 @@ static int passphrase_to_utf16(struct crypt_device *cd, char *input, size_t inle
char *ic_outbuf = NULL; char *ic_outbuf = NULL;
size_t r = 0; size_t r = 0;
if (inlen == 0)
return r;
outbuf = crypt_safe_alloc(inlen * 2); outbuf = crypt_safe_alloc(inlen * 2);
if (outbuf == NULL) if (outbuf == NULL)
return -ENOMEM; return -ENOMEM;