2021-03-02 18:56:20 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Darren Kenny <darren.kenny@oracle.com>
|
|
|
|
Date: Fri, 19 Feb 2021 17:12:23 +0000
|
|
|
|
Subject: [PATCH] net/tftp: Fix dangling memory pointer
|
|
|
|
|
|
|
|
The static code analysis tool, Parfait, reported that the valid of
|
|
|
|
file->data was left referencing memory that was freed by the call to
|
|
|
|
grub_free(data) where data was initialized from file->data.
|
|
|
|
|
|
|
|
To ensure that there is no unintentional access to this memory
|
|
|
|
referenced by file->data we should set the pointer to NULL.
|
|
|
|
|
|
|
|
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
|
|
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
|
|
|
---
|
|
|
|
grub-core/net/tftp.c | 1 +
|
|
|
|
1 file changed, 1 insertion(+)
|
|
|
|
|
|
|
|
diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
|
2022-05-10 07:20:45 +00:00
|
|
|
index b9a4b607a..aa0424dce 100644
|
2021-03-02 18:56:20 +00:00
|
|
|
--- a/grub-core/net/tftp.c
|
|
|
|
+++ b/grub-core/net/tftp.c
|
|
|
|
@@ -444,6 +444,7 @@ tftp_close (struct grub_file *file)
|
|
|
|
grub_net_udp_close (data->sock);
|
|
|
|
}
|
|
|
|
grub_free (data);
|
|
|
|
+ file->data = NULL;
|
|
|
|
return GRUB_ERR_NONE;
|
|
|
|
}
|
|
|
|
|