diff options
| author | Vijay Anusuri <vanusuri@mvista.com> | 2024-04-03 10:43:27 +0530 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2024-04-13 04:51:47 -0700 |
| commit | 601f38e5cd14298c821162dec74570fbaeb24454 (patch) | |
| tree | 792a5f6c6b47b0116013781db22cf1cf59e7906b | |
| parent | 50320bfdc802f82143d484f65d5f7496e3b8e1e1 (diff) | |
| download | poky-601f38e5cd14298c821162dec74570fbaeb24454.tar.gz | |
ncurses: Backport fix for CVE-2023-50495
Upstream-Status: Backport from https://github.com/ThomasDickey/ncurses-snapshots/commit/efe9674ee14b14b788f9618941f97d31742f0adc
Reference: https://invisible-island.net/archives/ncurses/6.4/ncurses-6.4-20230424.patch.gz
(From OE-Core rev: 530314b699a7ad53e6dcd96658873cef7014e483)
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
| -rw-r--r-- | meta/recipes-core/ncurses/files/CVE-2023-50495.patch | 79 | ||||
| -rw-r--r-- | meta/recipes-core/ncurses/ncurses_6.2.bb | 1 |
2 files changed, 80 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..58c23866d1 --- /dev/null +++ b/meta/recipes-core/ncurses/files/CVE-2023-50495.patch | |||
| @@ -0,0 +1,79 @@ | |||
| 1 | Fix for CVE-2023-50495 from upstream: | ||
| 2 | https://github.com/ThomasDickey/ncurses-snapshots/commit/efe9674ee14b14b788f9618941f97d31742f0adc | ||
| 3 | |||
| 4 | Reference: | ||
| 5 | https://invisible-island.net/archives/ncurses/6.4/ncurses-6.4-20230424.patch.gz | ||
| 6 | |||
| 7 | Upstream-Status: Backport [import from suse ftp.pbone.net/mirror/ftp.opensuse.org/update/leap-micro/5.3/sle/src/ncurses-6.1-150000.5.20.1.src.rpm | ||
| 8 | Upstream commit https://github.com/ThomasDickey/ncurses-snapshots/commit/efe9674ee14b14b788f9618941f97d31742f0adc] | ||
| 9 | CVE: CVE-2023-50495 | ||
| 10 | Signed-off-by: Vijay Anusuri <vanusuri@mvista.com> | ||
| 11 | --- | ||
| 12 | ncurses/tinfo/parse_entry.c | 23 ++++++++++++++++------- | ||
| 13 | 1 file changed, 16 insertions(+), 7 deletions(-) | ||
| 14 | |||
| 15 | diff --git a/ncurses/tinfo/parse_entry.c b/ncurses/tinfo/parse_entry.c | ||
| 16 | index 23574b66..56ba9ae6 100644 | ||
| 17 | --- a/ncurses/tinfo/parse_entry.c | ||
| 18 | +++ b/ncurses/tinfo/parse_entry.c | ||
| 19 | @@ -110,7 +110,7 @@ _nc_extend_names(ENTRY * entryp, const char *name, int token_type) | ||
| 20 | /* Well, we are given a cancel for a name that we don't recognize */ | ||
| 21 | return _nc_extend_names(entryp, name, STRING); | ||
| 22 | default: | ||
| 23 | - return 0; | ||
| 24 | + return NULL; | ||
| 25 | } | ||
| 26 | |||
| 27 | /* Adjust the 'offset' (insertion-point) to keep the lists of extended | ||
| 28 | @@ -142,6 +142,11 @@ _nc_extend_names(ENTRY * entryp, const char *name, int token_type) | ||
| 29 | for (last = (unsigned) (max - 1); last > tindex; last--) | ||
| 30 | |||
| 31 | if (!found) { | ||
| 32 | + char *saved; | ||
| 33 | + | ||
| 34 | + if ((saved = _nc_save_str(name)) == NULL) | ||
| 35 | + return NULL; | ||
| 36 | + | ||
| 37 | switch (token_type) { | ||
| 38 | case BOOLEAN: | ||
| 39 | tp->ext_Booleans++; | ||
| 40 | @@ -169,7 +174,7 @@ _nc_extend_names(ENTRY * entryp, const char *name, int token_type) | ||
| 41 | TYPE_REALLOC(char *, actual, tp->ext_Names); | ||
| 42 | while (--actual > offset) | ||
| 43 | tp->ext_Names[actual] = tp->ext_Names[actual - 1]; | ||
| 44 | - tp->ext_Names[offset] = _nc_save_str(name); | ||
| 45 | + tp->ext_Names[offset] = saved; | ||
| 46 | } | ||
| 47 | |||
| 48 | temp.nte_name = tp->ext_Names[offset]; | ||
| 49 | @@ -337,6 +342,8 @@ _nc_parse_entry(ENTRY * entryp, int literal, bool silent) | ||
| 50 | bool is_use = (strcmp(_nc_curr_token.tk_name, "use") == 0); | ||
| 51 | bool is_tc = !is_use && (strcmp(_nc_curr_token.tk_name, "tc") == 0); | ||
| 52 | if (is_use || is_tc) { | ||
| 53 | + char *saved; | ||
| 54 | + | ||
| 55 | if (!VALID_STRING(_nc_curr_token.tk_valstring) | ||
| 56 | || _nc_curr_token.tk_valstring[0] == '\0') { | ||
| 57 | _nc_warning("missing name for use-clause"); | ||
| 58 | @@ -350,11 +357,13 @@ _nc_parse_entry(ENTRY * entryp, int literal, bool silent) | ||
| 59 | _nc_curr_token.tk_valstring); | ||
| 60 | continue; | ||
| 61 | } | ||
| 62 | - entryp->uses[entryp->nuses].name = _nc_save_str(_nc_curr_token.tk_valstring); | ||
| 63 | - entryp->uses[entryp->nuses].line = _nc_curr_line; | ||
| 64 | - entryp->nuses++; | ||
| 65 | - if (entryp->nuses > 1 && is_tc) { | ||
| 66 | - BAD_TC_USAGE | ||
| 67 | + if ((saved = _nc_save_str(_nc_curr_token.tk_valstring)) != NULL) { | ||
| 68 | + entryp->uses[entryp->nuses].name = saved; | ||
| 69 | + entryp->uses[entryp->nuses].line = _nc_curr_line; | ||
| 70 | + entryp->nuses++; | ||
| 71 | + if (entryp->nuses > 1 && is_tc) { | ||
| 72 | + BAD_TC_USAGE | ||
| 73 | + } | ||
| 74 | } | ||
| 75 | } else { | ||
| 76 | /* normal token lookup */ | ||
| 77 | -- | ||
| 78 | 2.25.1 | ||
| 79 | |||
diff --git a/meta/recipes-core/ncurses/ncurses_6.2.bb b/meta/recipes-core/ncurses/ncurses_6.2.bb index 33285bcb5b..dbff149f55 100644 --- a/meta/recipes-core/ncurses/ncurses_6.2.bb +++ b/meta/recipes-core/ncurses/ncurses_6.2.bb | |||
| @@ -6,6 +6,7 @@ SRC_URI += "file://0001-tic-hang.patch \ | |||
| 6 | file://CVE-2021-39537.patch \ | 6 | file://CVE-2021-39537.patch \ |
| 7 | file://CVE-2022-29458.patch \ | 7 | file://CVE-2022-29458.patch \ |
| 8 | file://CVE-2023-29491.patch \ | 8 | file://CVE-2023-29491.patch \ |
| 9 | file://CVE-2023-50495.patch \ | ||
| 9 | " | 10 | " |
| 10 | # commit id corresponds to the revision in package version | 11 | # commit id corresponds to the revision in package version |
| 11 | SRCREV = "a669013cd5e9d6434e5301348ea51baf306c93c4" | 12 | SRCREV = "a669013cd5e9d6434e5301348ea51baf306c93c4" |
