diff options
| author | Peter Marko <peter.marko@siemens.com> | 2024-04-13 00:14:26 +0200 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2024-04-19 04:50:38 -0700 |
| commit | 71267466e9cea253067375376aa7cbbd1e0593e7 (patch) | |
| tree | 05eaa146e69893ed689fb61412689fefdeed3ada /meta | |
| parent | 9d9c54071e9b396fc02eafd1cb48a94b50db1c05 (diff) | |
| download | poky-71267466e9cea253067375376aa7cbbd1e0593e7.tar.gz | |
ncurses: patch CVE-2023-50495
backport relevant parts from
https://invisible-island.net/archives/ncurses/6.4/ncurses-6.4-20230424.patch.gz
(From OE-Core rev: 6a54788ebe147ecd8e347ff8d2ba95a1c461d27d)
Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta')
| -rw-r--r-- | meta/recipes-core/ncurses/files/CVE-2023-50495.patch | 81 | ||||
| -rw-r--r-- | meta/recipes-core/ncurses/ncurses_6.3+20220423.bb | 1 |
2 files changed, 82 insertions, 0 deletions
diff --git a/meta/recipes-core/ncurses/files/CVE-2023-50495.patch b/meta/recipes-core/ncurses/files/CVE-2023-50495.patch new file mode 100644 index 0000000000..e5a8f43b01 --- /dev/null +++ b/meta/recipes-core/ncurses/files/CVE-2023-50495.patch | |||
| @@ -0,0 +1,81 @@ | |||
| 1 | commit ebc08cff36689eec54edc1ce2de6ebac826bd6cd | ||
| 2 | Author: Peter Marko <peter.marko@siemens.com> | ||
| 3 | Date: Fri Apr 12 23:56:25 2024 +0200 | ||
| 4 | |||
| 5 | check return value of _nc_save_str(), in special case for tic where | ||
| 6 | extended capabilities are processed but the terminal description was | ||
| 7 | not initialized (report by Ziqiao Kong). | ||
| 8 | |||
| 9 | Only parts relevant for this CVE was extracted from upstream patch. | ||
| 10 | |||
| 11 | CVE: CVE-2023-45853 | ||
| 12 | Upstream-Status: Backport [https://invisible-island.net/archives/ncurses/6.4/ncurses-6.4-20230424.patch.gz] | ||
| 13 | |||
| 14 | Signed-off-by: Peter Marko <peter.marko@siemens.com> | ||
| 15 | |||
| 16 | --- | ||
| 17 | ncurses/tinfo/parse_entry.c | 23 ++++++++++++++++------- | ||
| 18 | 1 file changed, 16 insertions(+), 7 deletions(-) | ||
| 19 | |||
| 20 | diff --git a/ncurses/tinfo/parse_entry.c b/ncurses/tinfo/parse_entry.c | ||
| 21 | index a77cd0b..8ac02ac 100644 | ||
| 22 | --- a/ncurses/tinfo/parse_entry.c | ||
| 23 | +++ b/ncurses/tinfo/parse_entry.c | ||
| 24 | @@ -110,7 +110,7 @@ _nc_extend_names(ENTRY * entryp, const char *name, int token_type) | ||
| 25 | /* Well, we are given a cancel for a name that we don't recognize */ | ||
| 26 | return _nc_extend_names(entryp, name, STRING); | ||
| 27 | default: | ||
| 28 | - return 0; | ||
| 29 | + return NULL; | ||
| 30 | } | ||
| 31 | |||
| 32 | /* Adjust the 'offset' (insertion-point) to keep the lists of extended | ||
| 33 | @@ -142,6 +142,11 @@ _nc_extend_names(ENTRY * entryp, const char *name, int token_type) | ||
| 34 | for (last = (unsigned) (max - 1); last > tindex; last--) | ||
| 35 | |||
| 36 | if (!found) { | ||
| 37 | + char *saved; | ||
| 38 | + | ||
| 39 | + if ((saved = _nc_save_str(name)) == NULL) | ||
| 40 | + return NULL; | ||
| 41 | + | ||
| 42 | switch (token_type) { | ||
| 43 | case BOOLEAN: | ||
| 44 | tp->ext_Booleans++; | ||
| 45 | @@ -169,7 +174,7 @@ _nc_extend_names(ENTRY * entryp, const char *name, int token_type) | ||
| 46 | TYPE_REALLOC(char *, actual, tp->ext_Names); | ||
| 47 | while (--actual > offset) | ||
| 48 | tp->ext_Names[actual] = tp->ext_Names[actual - 1]; | ||
| 49 | - tp->ext_Names[offset] = _nc_save_str(name); | ||
| 50 | + tp->ext_Names[offset] = saved; | ||
| 51 | } | ||
| 52 | |||
| 53 | temp.nte_name = tp->ext_Names[offset]; | ||
| 54 | @@ -337,6 +342,8 @@ _nc_parse_entry(ENTRY * entryp, int literal, bool silent) | ||
| 55 | bool is_use = (strcmp(_nc_curr_token.tk_name, "use") == 0); | ||
| 56 | bool is_tc = !is_use && (strcmp(_nc_curr_token.tk_name, "tc") == 0); | ||
| 57 | if (is_use || is_tc) { | ||
| 58 | + char *saved; | ||
| 59 | + | ||
| 60 | if (!VALID_STRING(_nc_curr_token.tk_valstring) | ||
| 61 | || _nc_curr_token.tk_valstring[0] == '\0') { | ||
| 62 | _nc_warning("missing name for use-clause"); | ||
| 63 | @@ -350,11 +357,13 @@ _nc_parse_entry(ENTRY * entryp, int literal, bool silent) | ||
| 64 | _nc_curr_token.tk_valstring); | ||
| 65 | continue; | ||
| 66 | } | ||
| 67 | - entryp->uses[entryp->nuses].name = _nc_save_str(_nc_curr_token.tk_valstring); | ||
| 68 | - entryp->uses[entryp->nuses].line = _nc_curr_line; | ||
| 69 | - entryp->nuses++; | ||
| 70 | - if (entryp->nuses > 1 && is_tc) { | ||
| 71 | - BAD_TC_USAGE | ||
| 72 | + if ((saved = _nc_save_str(_nc_curr_token.tk_valstring)) != NULL) { | ||
| 73 | + entryp->uses[entryp->nuses].name = saved; | ||
| 74 | + entryp->uses[entryp->nuses].line = _nc_curr_line; | ||
| 75 | + entryp->nuses++; | ||
| 76 | + if (entryp->nuses > 1 && is_tc) { | ||
| 77 | + BAD_TC_USAGE | ||
| 78 | + } | ||
| 79 | } | ||
| 80 | } else { | ||
| 81 | /* normal token lookup */ | ||
diff --git a/meta/recipes-core/ncurses/ncurses_6.3+20220423.bb b/meta/recipes-core/ncurses/ncurses_6.3+20220423.bb index a34a7bdfdc..da1e6d838d 100644 --- a/meta/recipes-core/ncurses/ncurses_6.3+20220423.bb +++ b/meta/recipes-core/ncurses/ncurses_6.3+20220423.bb | |||
| @@ -4,6 +4,7 @@ SRC_URI += "file://0001-tic-hang.patch \ | |||
| 4 | file://0002-configure-reproducible.patch \ | 4 | file://0002-configure-reproducible.patch \ |
| 5 | file://0003-gen-pkgconfig.in-Do-not-include-LDFLAGS-in-generated.patch \ | 5 | file://0003-gen-pkgconfig.in-Do-not-include-LDFLAGS-in-generated.patch \ |
| 6 | file://CVE-2023-29491.patch \ | 6 | file://CVE-2023-29491.patch \ |
| 7 | file://CVE-2023-50495.patch \ | ||
| 7 | " | 8 | " |
| 8 | # commit id corresponds to the revision in package version | 9 | # commit id corresponds to the revision in package version |
| 9 | SRCREV = "a0bc708bc6954b5d3c0a38d92b683c3ec3135260" | 10 | SRCREV = "a0bc708bc6954b5d3c0a38d92b683c3ec3135260" |
