diff options
| -rw-r--r-- | meta/recipes-bsp/grub/files/0040-loader-xnu-Check-if-pointer-is-NULL-before-using-it.patch | 42 | ||||
| -rw-r--r-- | meta/recipes-bsp/grub/grub2.inc | 1 |
2 files changed, 43 insertions, 0 deletions
diff --git a/meta/recipes-bsp/grub/files/0040-loader-xnu-Check-if-pointer-is-NULL-before-using-it.patch b/meta/recipes-bsp/grub/files/0040-loader-xnu-Check-if-pointer-is-NULL-before-using-it.patch new file mode 100644 index 0000000000..8081f7763a --- /dev/null +++ b/meta/recipes-bsp/grub/files/0040-loader-xnu-Check-if-pointer-is-NULL-before-using-it.patch | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | From 778a3fffd19229e5650a1abfb06c974949991cd4 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Paulo Flabiano Smorigo <pfsmorigo@canonical.com> | ||
| 3 | Date: Mon, 30 Nov 2020 10:36:00 -0300 | ||
| 4 | Subject: [PATCH] loader/xnu: Check if pointer is NULL before using it | ||
| 5 | |||
| 6 | Fixes: CID 73654 | ||
| 7 | |||
| 8 | Signed-off-by: Paulo Flabiano Smorigo <pfsmorigo@canonical.com> | ||
| 9 | Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> | ||
| 10 | |||
| 11 | Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/grub.git/commit/?id=7c8a2b5d1421a0f2a33d33531f7561f3da93b844] | ||
| 12 | Signed-off-by: Marta Rybczynska <marta.rybczynska@huawei.com> | ||
| 13 | --- | ||
| 14 | grub-core/loader/xnu.c | 8 ++++---- | ||
| 15 | 1 file changed, 4 insertions(+), 4 deletions(-) | ||
| 16 | |||
| 17 | diff --git a/grub-core/loader/xnu.c b/grub-core/loader/xnu.c | ||
| 18 | index 39ceff8..adc048c 100644 | ||
| 19 | --- a/grub-core/loader/xnu.c | ||
| 20 | +++ b/grub-core/loader/xnu.c | ||
| 21 | @@ -667,6 +667,9 @@ grub_xnu_load_driver (char *infoplistname, grub_file_t binaryfile, | ||
| 22 | char *name, *nameend; | ||
| 23 | int namelen; | ||
| 24 | |||
| 25 | + if (infoplistname == NULL) | ||
| 26 | + return grub_error (GRUB_ERR_BAD_FILENAME, N_("missing p-list filename")); | ||
| 27 | + | ||
| 28 | name = get_name_ptr (infoplistname); | ||
| 29 | nameend = grub_strchr (name, '/'); | ||
| 30 | |||
| 31 | @@ -698,10 +701,7 @@ grub_xnu_load_driver (char *infoplistname, grub_file_t binaryfile, | ||
| 32 | else | ||
| 33 | macho = 0; | ||
| 34 | |||
| 35 | - if (infoplistname) | ||
| 36 | - infoplist = grub_file_open (infoplistname, GRUB_FILE_TYPE_XNU_INFO_PLIST); | ||
| 37 | - else | ||
| 38 | - infoplist = 0; | ||
| 39 | + infoplist = grub_file_open (infoplistname, GRUB_FILE_TYPE_XNU_INFO_PLIST); | ||
| 40 | grub_errno = GRUB_ERR_NONE; | ||
| 41 | if (infoplist) | ||
| 42 | { | ||
diff --git a/meta/recipes-bsp/grub/grub2.inc b/meta/recipes-bsp/grub/grub2.inc index eebe9a7233..fad7415e0d 100644 --- a/meta/recipes-bsp/grub/grub2.inc +++ b/meta/recipes-bsp/grub/grub2.inc | |||
| @@ -86,6 +86,7 @@ SRC_URI = "${GNU_MIRROR}/grub/grub-${PV}.tar.gz \ | |||
| 86 | file://0037-loader-bsd-Check-for-NULL-arg-up-front.patch \ | 86 | file://0037-loader-bsd-Check-for-NULL-arg-up-front.patch \ |
| 87 | file://0038-loader-xnu-Fix-memory-leak.patch \ | 87 | file://0038-loader-xnu-Fix-memory-leak.patch \ |
| 88 | file://0039-loader-xnu-Free-driverkey-data-when-an-error-is-dete.patch \ | 88 | file://0039-loader-xnu-Free-driverkey-data-when-an-error-is-dete.patch \ |
| 89 | file://0040-loader-xnu-Check-if-pointer-is-NULL-before-using-it.patch \ | ||
| 89 | " | 90 | " |
| 90 | SRC_URI[md5sum] = "5ce674ca6b2612d8939b9e6abed32934" | 91 | SRC_URI[md5sum] = "5ce674ca6b2612d8939b9e6abed32934" |
| 91 | SRC_URI[sha256sum] = "f10c85ae3e204dbaec39ae22fa3c5e99f0665417e91c2cb49b7e5031658ba6ea" | 92 | SRC_URI[sha256sum] = "f10c85ae3e204dbaec39ae22fa3c5e99f0665417e91c2cb49b7e5031658ba6ea" |
