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 09:46:25 +01:00
committed by Lennart Poettering
parent 79c8e46d23
commit 8c2264abb9
@@ -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) {