mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-15 04:40:05 +01:00
lib: fix potential segfault in LUKS2_token_buffer_free
The value of h may be NULL. Check it vefore visiting its memeber to avoid segfault. Signed-off-by: Lixiaokeng <lixiaokeng@huawei.com> Signed-off-by: Linfeilong <linfeilong@huawei.com>
This commit is contained in:
@@ -329,7 +329,7 @@ static void LUKS2_token_buffer_free(struct crypt_device *cd,
|
||||
{
|
||||
const crypt_token_handler *h = LUKS2_token_handler(cd, token);
|
||||
|
||||
if (h->buffer_free)
|
||||
if (h && h->buffer_free)
|
||||
h->buffer_free(buffer, buffer_len);
|
||||
else {
|
||||
crypt_safe_memzero(buffer, buffer_len);
|
||||
|
||||
Reference in New Issue
Block a user