diff options
| -rw-r--r-- | meta/recipes-devtools/binutils/binutils-2.38.inc | 1 | ||||
| -rw-r--r-- | meta/recipes-devtools/binutils/binutils/0027-CVE-2022-47008.patch | 67 |
2 files changed, 68 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils-2.38.inc b/meta/recipes-devtools/binutils/binutils-2.38.inc index da444ed1ba..125af13d74 100644 --- a/meta/recipes-devtools/binutils/binutils-2.38.inc +++ b/meta/recipes-devtools/binutils/binutils-2.38.inc | |||
| @@ -56,6 +56,7 @@ SRC_URI = "\ | |||
| 56 | file://0023-CVE-2023-25585.patch \ | 56 | file://0023-CVE-2023-25585.patch \ |
| 57 | file://0026-CVE-2023-1972.patch \ | 57 | file://0026-CVE-2023-1972.patch \ |
| 58 | file://0025-CVE-2023-25588.patch \ | 58 | file://0025-CVE-2023-25588.patch \ |
| 59 | file://0027-CVE-2022-47008.patch \ | ||
| 59 | file://0029-CVE-2022-48065-1.patch \ | 60 | file://0029-CVE-2022-48065-1.patch \ |
| 60 | file://0029-CVE-2022-48065-2.patch \ | 61 | file://0029-CVE-2022-48065-2.patch \ |
| 61 | file://0029-CVE-2022-48065-3.patch \ | 62 | file://0029-CVE-2022-48065-3.patch \ |
diff --git a/meta/recipes-devtools/binutils/binutils/0027-CVE-2022-47008.patch b/meta/recipes-devtools/binutils/binutils/0027-CVE-2022-47008.patch new file mode 100644 index 0000000000..a3fff65409 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0027-CVE-2022-47008.patch | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | From: Alan Modra <amodra@gmail.com> | ||
| 2 | Date: Thu, 16 Jun 2022 23:43:38 +0000 (+0930) | ||
| 3 | Subject: PR29255, memory leak in make_tempdir | ||
| 4 | X-Git-Tag: binutils-2_39~236 | ||
| 5 | X-Git-Url: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff_plain;h=d6e1d48c83b165c129cb0aa78905f7ca80a1f682 | ||
| 6 | |||
| 7 | PR29255, memory leak in make_tempdir | ||
| 8 | |||
| 9 | PR 29255 | ||
| 10 | * bucomm.c (make_tempdir, make_tempname): Free template on all | ||
| 11 | failure paths. | ||
| 12 | |||
| 13 | Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff_plain;h=d6e1d48c83b165c129cb0aa78905f7ca80a1f682] | ||
| 14 | |||
| 15 | CVE: CVE-2022-47008 | ||
| 16 | |||
| 17 | Signed-off-by: Deepthi Hemraj <Deepthi.Hemraj@windriver.com> | ||
| 18 | |||
| 19 | --- | ||
| 20 | |||
| 21 | diff --git a/binutils/bucomm.c b/binutils/bucomm.c | ||
| 22 | index fdc2209df9c..4395cb9f7f5 100644 | ||
| 23 | --- a/binutils/bucomm.c | ||
| 24 | +++ b/binutils/bucomm.c | ||
| 25 | @@ -537,8 +537,9 @@ make_tempname (const char *filename, int *ofd) | ||
| 26 | #else | ||
| 27 | tmpname = mktemp (tmpname); | ||
| 28 | if (tmpname == NULL) | ||
| 29 | - return NULL; | ||
| 30 | - fd = open (tmpname, O_RDWR | O_CREAT | O_EXCL, 0600); | ||
| 31 | + fd = -1; | ||
| 32 | + else | ||
| 33 | + fd = open (tmpname, O_RDWR | O_CREAT | O_EXCL, 0600); | ||
| 34 | #endif | ||
| 35 | if (fd == -1) | ||
| 36 | { | ||
| 37 | @@ -556,22 +557,23 @@ char * | ||
| 38 | make_tempdir (const char *filename) | ||
| 39 | { | ||
| 40 | char *tmpname = template_in_dir (filename); | ||
| 41 | + char *ret; | ||
| 42 | |||
| 43 | #ifdef HAVE_MKDTEMP | ||
| 44 | - return mkdtemp (tmpname); | ||
| 45 | + ret = mkdtemp (tmpname); | ||
| 46 | #else | ||
| 47 | - tmpname = mktemp (tmpname); | ||
| 48 | - if (tmpname == NULL) | ||
| 49 | - return NULL; | ||
| 50 | + ret = mktemp (tmpname); | ||
| 51 | #if defined (_WIN32) && !defined (__CYGWIN32__) | ||
| 52 | if (mkdir (tmpname) != 0) | ||
| 53 | - return NULL; | ||
| 54 | + ret = NULL; | ||
| 55 | #else | ||
| 56 | if (mkdir (tmpname, 0700) != 0) | ||
| 57 | - return NULL; | ||
| 58 | + ret = NULL; | ||
| 59 | #endif | ||
| 60 | - return tmpname; | ||
| 61 | #endif | ||
| 62 | + if (ret == NULL) | ||
| 63 | + free (tmpname); | ||
| 64 | + return ret; | ||
| 65 | } | ||
| 66 | |||
| 67 | /* Parse a string into a VMA, with a fatal error if it can't be | ||
