From 7d02eb14ad9119643e9727b11efff13662fe9063 Mon Sep 17 00:00:00 2001 From: Darren Kenny 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. Reference: http://git.savannah.gnu.org/cgit/grub.git/commit/grub-core/net/tftp.c?id=0cb838b281a68b536a09681f9557ea6a7ac5da7a Signed-off-by: Darren Kenny Reviewed-by: Daniel Kiper --- 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 index c054072..658caa2 100644 --- a/grub-core/net/tftp.c +++ b/grub-core/net/tftp.c @@ -448,6 +448,7 @@ tftp_close (struct grub_file *file) grub_net_udp_close (data->sock); } grub_free (data); + file->data = NULL; return GRUB_ERR_NONE; } -- 2.19.1