nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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