grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SECURITY PATCH 019/117] net/tftp: Fix dangling memory pointer


From: Daniel Kiper
Subject: [SECURITY PATCH 019/117] net/tftp: Fix dangling memory pointer
Date: Tue, 2 Mar 2021 19:00:26 +0100

From: Darren Kenny <darren.kenny@oracle.com>

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
index 7e659a78b..1f3793ed8 100644
--- a/grub-core/net/tftp.c
+++ b/grub-core/net/tftp.c
@@ -442,6 +442,7 @@ tftp_close (struct grub_file *file)
       grub_net_udp_close (data->sock);
     }
   grub_free (data);
+  file->data = NULL;
   return GRUB_ERR_NONE;
 }
 
-- 
2.11.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]