mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-11 10:50:01 +01:00
Fix a possible memory leak of verity signature description.
The signature description should be allocated only if params field is used, otherwise we can leak the string value. (Moreover, the query path is currently used only for flag, not for the value.)
This commit is contained in:
@@ -2303,16 +2303,16 @@ static int _dm_target_query_verity(struct crypt_device *cd,
|
||||
str = strsep(¶ms, " ");
|
||||
if (!str)
|
||||
goto err;
|
||||
if (!root_hash_sig_key_desc) {
|
||||
if (vp && !root_hash_sig_key_desc) {
|
||||
root_hash_sig_key_desc = strdup(str);
|
||||
if (!root_hash_sig_key_desc) {
|
||||
r = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
/* not stored in params, but cannot be used without vp */
|
||||
vp->flags |= CRYPT_VERITY_ROOT_HASH_SIGNATURE;
|
||||
}
|
||||
i++;
|
||||
if (vp)
|
||||
vp->flags |= CRYPT_VERITY_ROOT_HASH_SIGNATURE;
|
||||
} else /* unknown option */
|
||||
goto err;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user