mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
Fix NULL key_description bug in luks2-keyring token.
json-c parser transforms NULL pointer into special '(null)' string. While being technically correct it hides the fact user passed NULL pointer in crypt_token_params_luks2_keyring structure. This bug could be trigerred by calling crypt_token_luks2_keyring_set().
This commit is contained in:
@@ -1744,7 +1744,7 @@ static void TokenActivationByKeyring(void)
|
||||
.key_description = KEY_DESC_TEST0
|
||||
}, params2 = {
|
||||
.key_description = KEY_DESC_TEST1
|
||||
};
|
||||
}, params_invalid = {};
|
||||
uint64_t r_payload_offset;
|
||||
|
||||
if (!t_dm_crypt_keyring_support()) {
|
||||
@@ -1763,6 +1763,7 @@ static void TokenActivationByKeyring(void)
|
||||
OK_(set_fast_pbkdf(cd));
|
||||
OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, NULL, 32, NULL));
|
||||
EQ_(crypt_keyslot_add_by_volume_key(cd, 0, NULL, 32, PASSPHRASE, strlen(PASSPHRASE)), 0);
|
||||
FAIL_(crypt_token_luks2_keyring_set(cd, CRYPT_ANY_TOKEN, ¶ms_invalid), "Invalid key description property.");
|
||||
EQ_(crypt_token_luks2_keyring_set(cd, 3, ¶ms), 3);
|
||||
EQ_(crypt_token_assign_keyslot(cd, 3, 0), 3);
|
||||
CRYPT_FREE(cd);
|
||||
|
||||
Reference in New Issue
Block a user