1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-06 17:18:12 +03:00

cryptsetup: check the existence of salt by salt_size > 0

Follow-up for 504d0acf61.

The function may be called with non-NULL salt and salt_size == 0.
This commit is contained in:
Yu Watanabe 2023-02-17 08:24:54 +09:00 committed by Lennart Poettering
parent 79c8e46d23
commit 8c2264abb9

View File

@ -56,7 +56,7 @@ int acquire_luks2_key(
return -ENOANO;
/* If we're using a PIN, and the luks header has a salt, it better have a pin too */
if ((flags & TPM2_FLAGS_USE_PIN) && salt && !pin)
if ((flags & TPM2_FLAGS_USE_PIN) && salt_size > 0 && !pin)
return -ENOANO;
if (pin && salt_size > 0) {