From 5ec2fbcd38a9f054d5fbd500500e84b5c3d3e215 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojt=C4=9Bch=20Trefn=C3=BD?= Date: Thu, 21 Nov 2019 17:41:15 +0100 Subject: [PATCH] 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. --- lib/bitlk/bitlk.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/bitlk/bitlk.c b/lib/bitlk/bitlk.c index b103a18f..b40de05b 100644 --- a/lib/bitlk/bitlk.c +++ b/lib/bitlk/bitlk.c @@ -227,6 +227,9 @@ static int passphrase_to_utf16(struct crypt_device *cd, char *input, size_t inle char *ic_outbuf = NULL; size_t r = 0; + if (inlen == 0) + return r; + outbuf = crypt_safe_alloc(inlen * 2); if (outbuf == NULL) return -ENOMEM;