summaryrefslogtreecommitdiffstats
path: root/meta/recipes-bsp/grub/files/0003-net-tftp-Fix-dangling-memory-pointer.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-bsp/grub/files/0003-net-tftp-Fix-dangling-memory-pointer.patch')
-rw-r--r--meta/recipes-bsp/grub/files/0003-net-tftp-Fix-dangling-memory-pointer.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/meta/recipes-bsp/grub/files/0003-net-tftp-Fix-dangling-memory-pointer.patch b/meta/recipes-bsp/grub/files/0003-net-tftp-Fix-dangling-memory-pointer.patch
new file mode 100644
index 0000000000..3b4633507d
--- /dev/null
+++ b/meta/recipes-bsp/grub/files/0003-net-tftp-Fix-dangling-memory-pointer.patch
@@ -0,0 +1,33 @@
1From 09cc0df477758b60f51fbc0da1dee2f5d54c333d Mon Sep 17 00:00:00 2001
2From: Darren Kenny <darren.kenny@oracle.com>
3Date: Fri, 19 Feb 2021 17:12:23 +0000
4Subject: [PATCH] net/tftp: Fix dangling memory pointer
5
6The static code analysis tool, Parfait, reported that the valid of
7file->data was left referencing memory that was freed by the call to
8grub_free(data) where data was initialized from file->data.
9
10To ensure that there is no unintentional access to this memory
11referenced by file->data we should set the pointer to NULL.
12
13Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
14Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
15
16Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/grub.git/commit/?id=0cb838b281a68b536a09681f9557ea6a7ac5da7a]
17Signed-off-by: Marta Rybczynska <marta.rybczynska@huawei.com>
18---
19 grub-core/net/tftp.c | 1 +
20 1 file changed, 1 insertion(+)
21
22diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
23index 7d90bf6..f76b19f 100644
24--- a/grub-core/net/tftp.c
25+++ b/grub-core/net/tftp.c
26@@ -468,6 +468,7 @@ tftp_close (struct grub_file *file)
27 }
28 destroy_pq (data);
29 grub_free (data);
30+ file->data = NULL;
31 return GRUB_ERR_NONE;
32 }
33