Blame SOURCES/0389-net-tftp-Fix-dangling-memory-pointer.patch

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