summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/ncurses/files/CVE-2023-50495.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/ncurses/files/CVE-2023-50495.patch')
-rw-r--r--meta/recipes-core/ncurses/files/CVE-2023-50495.patch79
1 files changed, 79 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 @@
1Fix for CVE-2023-50495 from upstream:
2https://github.com/ThomasDickey/ncurses-snapshots/commit/efe9674ee14b14b788f9618941f97d31742f0adc
3
4Reference:
5https://invisible-island.net/archives/ncurses/6.4/ncurses-6.4-20230424.patch.gz
6
7Upstream-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
8Upstream commit https://github.com/ThomasDickey/ncurses-snapshots/commit/efe9674ee14b14b788f9618941f97d31742f0adc]
9CVE: CVE-2023-50495
10Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
11---
12 ncurses/tinfo/parse_entry.c | 23 ++++++++++++++++-------
13 1 file changed, 16 insertions(+), 7 deletions(-)
14
15diff --git a/ncurses/tinfo/parse_entry.c b/ncurses/tinfo/parse_entry.c
16index 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--
782.25.1
79