1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-06 12:58:22 +03:00

cryptsetup: check the existence of salt by salt_size > 0

Follow-up for 504d0acf61c8472bc93c2a927e858074873b2eaf.

The function may be called with non-NULL salt and salt_size == 0.

(cherry picked from commit 8c2264abb9c16bc2933f95be299f15ee66c21181)
This commit is contained in:
Yu Watanabe 2023-02-17 08:24:54 +09:00 committed by Zbigniew Jędrzejewski-Szmek
parent cd5de2811a
commit 6b6df9a845

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) {