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:
Ondrej Kozina
2022-09-01 15:21:41 +02:00
parent 94e8a7ca96
commit eac02f5605
2 changed files with 3 additions and 2 deletions

View File

@@ -5931,7 +5931,7 @@ int crypt_token_luks2_keyring_set(struct crypt_device *cd,
int r;
char json[4096];
if (!params)
if (!params || !params->key_description)
return -EINVAL;
log_dbg(cd, "Creating new LUKS2 keyring token (%d).", token);