diff options
Diffstat (limited to 'meta/recipes-core/ncurses/files')
10 files changed, 1529 insertions, 572 deletions
diff --git a/meta/recipes-core/ncurses/files/0001-Fix-CVE-2023-29491.patch b/meta/recipes-core/ncurses/files/0001-Fix-CVE-2023-29491.patch new file mode 100644 index 0000000000..1232c8c2a8 --- /dev/null +++ b/meta/recipes-core/ncurses/files/0001-Fix-CVE-2023-29491.patch @@ -0,0 +1,462 @@ +From 3d54a41f12e9aa059f06e66e72d872f2283395b6 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Sun, 30 Jul 2023 21:14:00 -0700 +Subject: [PATCH] Fix CVE-2023-29491 + +CVE: CVE-2023-29491 + +Upstream-Status: Backport [http://ncurses.scripts.mit.edu/?p=ncurses.git;a=commitdiff;h=eb51b1ea1f75a0ec17c9c5937cb28df1e8eeec56] + +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +--- + ncurses/tinfo/lib_tgoto.c | 10 +++- + ncurses/tinfo/lib_tparm.c | 116 ++++++++++++++++++++++++++++++++----- + ncurses/tinfo/read_entry.c | 3 + + progs/tic.c | 6 ++ + progs/tparm_type.c | 9 +++ + progs/tparm_type.h | 2 + + progs/tput.c | 61 ++++++++++++++++--- + 7 files changed, 185 insertions(+), 22 deletions(-) + +diff --git a/ncurses/tinfo/lib_tgoto.c b/ncurses/tinfo/lib_tgoto.c +index 9cf5e100..c50ed4df 100644 +--- a/ncurses/tinfo/lib_tgoto.c ++++ b/ncurses/tinfo/lib_tgoto.c +@@ -207,6 +207,14 @@ tgoto(const char *string, int x, int y) + result = tgoto_internal(string, x, y); + else + #endif +- result = TIPARM_2(string, y, x); ++ if ((result = TIPARM_2(string, y, x)) == NULL) { ++ /* ++ * Because termcap did not provide a more general solution such as ++ * tparm(), it was necessary to handle single-parameter capabilities ++ * using tgoto(). The internal _nc_tiparm() function returns a NULL ++ * for that case; retry for the single-parameter case. ++ */ ++ result = TIPARM_1(string, y); ++ } + returnPtr(result); + } +diff --git a/ncurses/tinfo/lib_tparm.c b/ncurses/tinfo/lib_tparm.c +index d9bdfd8f..a10a3877 100644 +--- a/ncurses/tinfo/lib_tparm.c ++++ b/ncurses/tinfo/lib_tparm.c +@@ -1086,6 +1086,64 @@ tparam_internal(TPARM_STATE *tps, const char *string, TPARM_DATA *data) + return (TPS(out_buff)); + } + ++#ifdef CUR ++/* ++ * Only a few standard capabilities accept string parameters. The others that ++ * are parameterized accept only numeric parameters. ++ */ ++static bool ++check_string_caps(TPARM_DATA *data, const char *string) ++{ ++ bool result = FALSE; ++ ++#define CHECK_CAP(name) (VALID_STRING(name) && !strcmp(name, string)) ++ ++ /* ++ * Disallow string parameters unless we can check them against a terminal ++ * description. ++ */ ++ if (cur_term != NULL) { ++ int want_type = 0; ++ ++ if (CHECK_CAP(pkey_key)) ++ want_type = 2; /* function key #1, type string #2 */ ++ else if (CHECK_CAP(pkey_local)) ++ want_type = 2; /* function key #1, execute string #2 */ ++ else if (CHECK_CAP(pkey_xmit)) ++ want_type = 2; /* function key #1, transmit string #2 */ ++ else if (CHECK_CAP(plab_norm)) ++ want_type = 2; /* label #1, show string #2 */ ++ else if (CHECK_CAP(pkey_plab)) ++ want_type = 6; /* function key #1, type string #2, show string #3 */ ++#if NCURSES_XNAMES ++ else { ++ char *check; ++ ++ check = tigetstr("Cs"); ++ if (CHECK_CAP(check)) ++ want_type = 1; /* style #1 */ ++ ++ check = tigetstr("Ms"); ++ if (CHECK_CAP(check)) ++ want_type = 3; /* storage unit #1, content #2 */ ++ } ++#endif ++ ++ if (want_type == data->tparm_type) { ++ result = TRUE; ++ } else { ++ T(("unexpected string-parameter")); ++ } ++ } ++ return result; ++} ++ ++#define ValidCap() (myData.tparm_type == 0 || \ ++ check_string_caps(&myData, string)) ++#else ++#define ValidCap() 1 ++#endif ++ + #if NCURSES_TPARM_VARARGS + + NCURSES_EXPORT(char *) +@@ -1100,7 +1158,7 @@ tparm(const char *string, ...) + tps->tname = "tparm"; + #endif /* TRACE */ + +- if (tparm_setup(cur_term, string, &myData) == OK) { ++ if (tparm_setup(cur_term, string, &myData) == OK && ValidCap()) { + va_list ap; + + va_start(ap, string); +@@ -1135,7 +1193,7 @@ tparm(const char *string, + tps->tname = "tparm"; + #endif /* TRACE */ + +- if (tparm_setup(cur_term, string, &myData) == OK) { ++ if (tparm_setup(cur_term, string, &myData) == OK && ValidCap()) { + + myData.param[0] = a1; + myData.param[1] = a2; +@@ -1166,7 +1224,7 @@ tiparm(const char *string, ...) + tps->tname = "tiparm"; + #endif /* TRACE */ + +- if (tparm_setup(cur_term, string, &myData) == OK) { ++ if (tparm_setup(cur_term, string, &myData) == OK && ValidCap()) { + va_list ap; + + va_start(ap, string); +@@ -1179,7 +1237,25 @@ tiparm(const char *string, ...) + } + + /* +- * The internal-use flavor ensures that the parameters are numbers, not strings ++ * The internal-use flavor ensures that parameters are numbers, not strings. ++ * In addition to ensuring that they are numbers, it ensures that the parameter ++ * count is consistent with intended usage. ++ * ++ * Unlike the general-purpose tparm/tiparm, these internal calls are fairly ++ * well defined: ++ * ++ * expected == 0 - not applicable ++ * expected == 1 - set color, or vertical/horizontal addressing ++ * expected == 2 - cursor addressing ++ * expected == 4 - initialize color or color pair ++ * expected == 9 - set attributes ++ * ++ * Only for the last case (set attributes) should a parameter be optional. ++ * Also, a capability which calls for more parameters than expected should be ++ * ignored. ++ * ++ * Return a null if the parameter-checks fail. Otherwise, return a pointer to ++ * the formatted capability string. + */ + NCURSES_EXPORT(char *) + _nc_tiparm(int expected, const char *string, ...) +@@ -1189,22 +1265,36 @@ _nc_tiparm(int expected, const char *string, ...) + char *result = NULL; + + _nc_tparm_err = 0; ++ T((T_CALLED("_nc_tiparm(%d, %s, ...)"), expected, _nc_visbuf(string))); + #ifdef TRACE + tps->tname = "_nc_tiparm"; + #endif /* TRACE */ + +- if (tparm_setup(cur_term, string, &myData) == OK +- && myData.num_actual <= expected +- && myData.tparm_type == 0) { +- va_list ap; ++ if (tparm_setup(cur_term, string, &myData) == OK && ValidCap()) { ++ if (myData.num_actual == 0) { ++ T(("missing parameter%s, expected %s%d", ++ expected > 1 ? "s" : "", ++ expected == 9 ? "up to " : "", ++ expected)); ++ } else if (myData.num_actual > expected) { ++ T(("too many parameters, have %d, expected %d", ++ myData.num_actual, ++ expected)); ++ } else if (expected != 9 && myData.num_actual != expected) { ++ T(("expected %d parameters, have %d", ++ myData.num_actual, ++ expected)); ++ } else { ++ va_list ap; + +- va_start(ap, string); +- tparm_copy_valist(&myData, FALSE, ap); +- va_end(ap); ++ va_start(ap, string); ++ tparm_copy_valist(&myData, FALSE, ap); ++ va_end(ap); + +- result = tparam_internal(tps, string, &myData); ++ result = tparam_internal(tps, string, &myData); ++ } + } +- return result; ++ returnPtr(result); + } + + /* +diff --git a/ncurses/tinfo/read_entry.c b/ncurses/tinfo/read_entry.c +index 2b1875ed..341337d2 100644 +--- a/ncurses/tinfo/read_entry.c ++++ b/ncurses/tinfo/read_entry.c +@@ -323,6 +323,9 @@ _nc_read_termtype(TERMTYPE2 *ptr, char *buffer, int limit) + || bool_count < 0 + || num_count < 0 + || str_count < 0 ++ || bool_count > BOOLCOUNT ++ || num_count > NUMCOUNT ++ || str_count > STRCOUNT + || str_size < 0) { + returnDB(TGETENT_NO); + } +diff --git a/progs/tic.c b/progs/tic.c +index 93a0b491..888927e2 100644 +--- a/progs/tic.c ++++ b/progs/tic.c +@@ -2270,9 +2270,15 @@ check_1_infotocap(const char *name, NCURSES_CONST char *value, int count) + + _nc_reset_tparm(NULL); + switch (actual) { ++ case Str: ++ result = TPARM_1(value, strings[1]); ++ break; + case Num_Str: + result = TPARM_2(value, numbers[1], strings[2]); + break; ++ case Str_Str: ++ result = TPARM_2(value, strings[1], strings[2]); ++ break; + case Num_Str_Str: + result = TPARM_3(value, numbers[1], strings[2], strings[3]); + break; +diff --git a/progs/tparm_type.c b/progs/tparm_type.c +index 3da4a077..644aa62a 100644 +--- a/progs/tparm_type.c ++++ b/progs/tparm_type.c +@@ -47,6 +47,7 @@ tparm_type(const char *name) + {code, {longname} }, \ + {code, {ti} }, \ + {code, {tc} } ++#define XD(code, onlyname) TD(code, onlyname, onlyname, onlyname) + TParams result = Numbers; + /* *INDENT-OFF* */ + static const struct { +@@ -58,6 +59,10 @@ tparm_type(const char *name) + TD(Num_Str, "pkey_xmit", "pfx", "px"), + TD(Num_Str, "plab_norm", "pln", "pn"), + TD(Num_Str_Str, "pkey_plab", "pfxl", "xl"), ++#if NCURSES_XNAMES ++ XD(Str, "Cs"), ++ XD(Str_Str, "Ms"), ++#endif + }; + /* *INDENT-ON* */ + +@@ -80,12 +85,16 @@ guess_tparm_type(int nparam, char **p_is_s) + case 1: + if (!p_is_s[0]) + result = Numbers; ++ if (p_is_s[0]) ++ result = Str; + break; + case 2: + if (!p_is_s[0] && !p_is_s[1]) + result = Numbers; + if (!p_is_s[0] && p_is_s[1]) + result = Num_Str; ++ if (p_is_s[0] && p_is_s[1]) ++ result = Str_Str; + break; + case 3: + if (!p_is_s[0] && !p_is_s[1] && !p_is_s[2]) +diff --git a/progs/tparm_type.h b/progs/tparm_type.h +index 7c102a30..af5bcf0f 100644 +--- a/progs/tparm_type.h ++++ b/progs/tparm_type.h +@@ -45,8 +45,10 @@ + typedef enum { + Other = -1 + ,Numbers = 0 ++ ,Str + ,Num_Str + ,Num_Str_Str ++ ,Str_Str + } TParams; + + extern TParams tparm_type(const char *name); +diff --git a/progs/tput.c b/progs/tput.c +index 4cd0c5ba..41508b72 100644 +--- a/progs/tput.c ++++ b/progs/tput.c +@@ -1,5 +1,5 @@ + /**************************************************************************** +- * Copyright 2018-2021,2022 Thomas E. Dickey * ++ * Copyright 2018-2022,2023 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * +@@ -47,12 +47,15 @@ + #include <transform.h> + #include <tty_settings.h> + +-MODULE_ID("$Id: tput.c,v 1.99 2022/02/26 23:19:31 tom Exp $") ++MODULE_ID("$Id: tput.c,v 1.102 2023/04/08 16:26:36 tom Exp $") + + #define PUTS(s) fputs(s, stdout) + + const char *_nc_progname = "tput"; + ++static bool opt_v = FALSE; /* quiet, do not show warnings */ ++static bool opt_x = FALSE; /* clear scrollback if possible */ ++ + static bool is_init = FALSE; + static bool is_reset = FALSE; + static bool is_clear = FALSE; +@@ -81,6 +84,7 @@ usage(const char *optstring) + KEEP(" -S << read commands from standard input") + KEEP(" -T TERM use this instead of $TERM") + KEEP(" -V print curses-version") ++ KEEP(" -v verbose, show warnings") + KEEP(" -x do not try to clear scrollback") + KEEP("") + KEEP("Commands:") +@@ -148,7 +152,7 @@ exit_code(int token, int value) + * Returns nonzero on error. + */ + static int +-tput_cmd(int fd, TTY * settings, bool opt_x, int argc, char **argv, int *used) ++tput_cmd(int fd, TTY * settings, int argc, char **argv, int *used) + { + NCURSES_CONST char *name; + char *s; +@@ -231,7 +235,9 @@ tput_cmd(int fd, TTY * settings, bool opt_x, int argc, char **argv, int *used) + } else if (VALID_STRING(s)) { + if (argc > 1) { + int k; ++ int narg; + int analyzed; ++ int provided; + int popcount; + long numbers[1 + NUM_PARM]; + char *strings[1 + NUM_PARM]; +@@ -271,14 +277,45 @@ tput_cmd(int fd, TTY * settings, bool opt_x, int argc, char **argv, int *used) + + popcount = 0; + _nc_reset_tparm(NULL); ++ /* ++ * Count the number of numeric parameters which are provided. ++ */ ++ provided = 0; ++ for (narg = 1; narg < argc; ++narg) { ++ char *ending = NULL; ++ long check = strtol(argv[narg], &ending, 10); ++ if (check < 0 || ending == argv[narg] || *ending != '\0') ++ break; ++ provided = narg; ++ } + switch (paramType) { ++ case Str: ++ s = TPARM_1(s, strings[1]); ++ analyzed = 1; ++ if (provided == 0 && argc >= 1) ++ provided++; ++ break; ++ case Str_Str: ++ s = TPARM_2(s, strings[1], strings[2]); ++ analyzed = 2; ++ if (provided == 0 && argc >= 1) ++ provided++; ++ if (provided == 1 && argc >= 2) ++ provided++; ++ break; + case Num_Str: + s = TPARM_2(s, numbers[1], strings[2]); + analyzed = 2; ++ if (provided == 1 && argc >= 2) ++ provided++; + break; + case Num_Str_Str: + s = TPARM_3(s, numbers[1], strings[2], strings[3]); + analyzed = 3; ++ if (provided == 1 && argc >= 2) ++ provided++; ++ if (provided == 2 && argc >= 3) ++ provided++; + break; + case Numbers: + analyzed = _nc_tparm_analyze(NULL, s, p_is_s, &popcount); +@@ -316,7 +353,13 @@ tput_cmd(int fd, TTY * settings, bool opt_x, int argc, char **argv, int *used) + if (analyzed < popcount) { + analyzed = popcount; + } +- *used += analyzed; ++ if (opt_v && (analyzed != provided)) { ++ fprintf(stderr, "%s: %s parameters for \"%s\"\n", ++ _nc_progname, ++ (analyzed < provided ? "extra" : "missing"), ++ argv[0]); ++ } ++ *used += provided; + } + + /* use putp() in order to perform padding */ +@@ -339,7 +382,6 @@ main(int argc, char **argv) + int used; + TTY old_settings; + TTY tty_settings; +- bool opt_x = FALSE; /* clear scrollback if possible */ + bool is_alias; + bool need_tty; + +@@ -348,7 +390,7 @@ main(int argc, char **argv) + + term = getenv("TERM"); + +- while ((c = getopt(argc, argv, is_alias ? "T:Vx" : "ST:Vx")) != -1) { ++ while ((c = getopt(argc, argv, is_alias ? "T:Vvx" : "ST:Vvx")) != -1) { + switch (c) { + case 'S': + cmdline = FALSE; +@@ -361,6 +403,9 @@ main(int argc, char **argv) + case 'V': + puts(curses_version()); + ExitProgram(EXIT_SUCCESS); ++ case 'v': /* verbose */ ++ opt_v = TRUE; ++ break; + case 'x': /* do not try to clear scrollback */ + opt_x = TRUE; + break; +@@ -404,7 +449,7 @@ main(int argc, char **argv) + usage(NULL); + while (argc > 0) { + tty_settings = old_settings; +- code = tput_cmd(fd, &tty_settings, opt_x, argc, argv, &used); ++ code = tput_cmd(fd, &tty_settings, argc, argv, &used); + if (code != 0) + break; + argc -= used; +@@ -439,7 +484,7 @@ main(int argc, char **argv) + while (argnum > 0) { + int code; + tty_settings = old_settings; +- code = tput_cmd(fd, &tty_settings, opt_x, argnum, argnow, &used); ++ code = tput_cmd(fd, &tty_settings, argnum, argnow, &used); + if (code != 0) { + if (result == 0) + result = ErrSystem(0); /* will return value >4 */ +-- +2.40.0 + diff --git a/meta/recipes-core/ncurses/files/0001-Updating-reset-code-ncurses-6.4-patch-20231104.patch b/meta/recipes-core/ncurses/files/0001-Updating-reset-code-ncurses-6.4-patch-20231104.patch new file mode 100644 index 0000000000..121db6bffe --- /dev/null +++ b/meta/recipes-core/ncurses/files/0001-Updating-reset-code-ncurses-6.4-patch-20231104.patch @@ -0,0 +1,499 @@ +From 135d37072755704b8d018e5de74e62ff3f28c930 Mon Sep 17 00:00:00 2001 +From: Thomas E. Dickey <dickey@invisible-island.net> +Date: Sun, 5 Nov 2023 05:54:54 +0530 +Subject: [PATCH] Updating reset code - ncurses 6.4 - patch 20231104 + ++ modify reset command to avoid altering clocal if the terminal uses a + modem (prompted by discussion with Werner Fink, Michal Suchanek, + OpenSUSE #1201384, Debian #60377). ++ build-fixes for --with-caps variations. ++ correct a couple of section-references in INSTALL. + +Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +Upstream-Status: Backport [https://ncurses.scripts.mit.edu/?p=ncurses.git;a=commitdiff;h=135d37072755704b8d018e5de74e62ff3f28c930] + +Signed-off-by: Soumya Sambu <soumya.sambu@windriver.com> +--- + INSTALL | 8 +- + include/curses.events | 2 +- + ncurses/tinfo/lib_tparm.c | 2 + + progs/reset_cmd.c | 281 +++++++++++++++++++++----------------- + progs/tabs.c | 10 +- + progs/tic.c | 4 + + 6 files changed, 176 insertions(+), 131 deletions(-) + +diff --git a/INSTALL b/INSTALL +index d9c1dd12..d0a39af0 100644 +--- a/INSTALL ++++ b/INSTALL +@@ -47,7 +47,7 @@ If you are converting from BSD curses and do not have root access, be sure + to read the BSD CONVERSION NOTES section below. + + If you are trying to build applications using gpm with ncurses, +-read the USING NCURSES WITH GPM section below. ++read the USING GPM section below. + + If you are cross-compiling, see the note below on BUILDING WITH A CROSS-COMPILER. + +@@ -79,7 +79,7 @@ INSTALLATION PROCEDURE: + The --prefix option to configure changes the root directory for installing + ncurses. The default is normally in subdirectories of /usr/local, except + for systems where ncurses is normally installed as a system library (see +- "IF YOU ARE A SYSTEM INTEGRATOR"). Use --prefix=/usr to replace your ++ "FOR SYSTEM INTEGRATORS"). Use --prefix=/usr to replace your + default curses distribution. + + The package gets installed beneath the --prefix directory as follows: +@@ -176,7 +176,7 @@ INSTALLATION PROCEDURE: + You can make curses and terminfo fall back to an existing file of termcap + definitions by configuring with --enable-termcap. If you do this, the + library will search /etc/termcap before the terminfo database, and will +- also interpret the contents of the TERM environment variable. See the ++ also interpret the contents of the $TERM environment variable. See the + section BSD CONVERSION NOTES below. + + 3. Type `make'. Ignore any warnings, no error messages should be produced. +@@ -1231,7 +1231,7 @@ CONFIGURE OPTIONS: + Specify a search-list of terminfo directories which will be compiled + into the ncurses library (default: DATADIR/terminfo) + +- This is a colon-separated list, like the TERMINFO_DIRS environment ++ This is a colon-separated list, like the $TERMINFO_DIRS environment + variable. + + --with-termlib[=XXX] +diff --git a/include/curses.events b/include/curses.events +index 25a2583f..468bde18 100644 +--- a/include/curses.events ++++ b/include/curses.events +@@ -50,6 +50,6 @@ typedef struct + extern NCURSES_EXPORT(int) wgetch_events (WINDOW *, _nc_eventlist *) GCC_DEPRECATED(experimental option); /* experimental */ + extern NCURSES_EXPORT(int) wgetnstr_events (WINDOW *,char *,int,_nc_eventlist *) GCC_DEPRECATED(experimental option); /* experimental */ + +-#define KEY_EVENT 0633 /* We were interrupted by an event */ ++#define KEY_EVENT 0634 /* We were interrupted by an event */ + + #endif /* NCURSES_WGETCH_EVENTS */ +diff --git a/ncurses/tinfo/lib_tparm.c b/ncurses/tinfo/lib_tparm.c +index a10a3877..cd972c0f 100644 +--- a/ncurses/tinfo/lib_tparm.c ++++ b/ncurses/tinfo/lib_tparm.c +@@ -1113,8 +1113,10 @@ check_string_caps(TPARM_DATA *data, const char *string) + want_type = 2; /* function key #1, transmit string #2 */ + else if (CHECK_CAP(plab_norm)) + want_type = 2; /* label #1, show string #2 */ ++#ifdef pkey_plab + else if (CHECK_CAP(pkey_plab)) + want_type = 6; /* function key #1, type string #2, show string #3 */ ++#endif + #if NCURSES_XNAMES + else { + char *check; +diff --git a/progs/reset_cmd.c b/progs/reset_cmd.c +index eff3af72..aec4b077 100644 +--- a/progs/reset_cmd.c ++++ b/progs/reset_cmd.c +@@ -75,6 +75,9 @@ MODULE_ID("$Id: reset_cmd.c,v 1.28 2021/10/02 18:08:44 tom Exp $") + # endif + #endif + ++#define set_flags(target, mask) target |= mask ++#define clear_flags(target, mask) target &= ~((unsigned)(mask)) ++ + static FILE *my_file; + + static bool use_reset = FALSE; /* invoked as reset */ +@@ -188,6 +191,79 @@ out_char(int c) + #define reset_char(item, value) \ + tty_settings->c_cc[item] = CHK(tty_settings->c_cc[item], value) + ++/* ++ * Simplify ifdefs ++ */ ++#ifndef BSDLY ++#define BSDLY 0 ++#endif ++#ifndef CRDLY ++#define CRDLY 0 ++#endif ++#ifndef ECHOCTL ++#define ECHOCTL 0 ++#endif ++#ifndef ECHOKE ++#define ECHOKE 0 ++#endif ++#ifndef ECHOPRT ++#define ECHOPRT 0 ++#endif ++#ifndef FFDLY ++#define FFDLY 0 ++#endif ++#ifndef IMAXBEL ++#define IMAXBEL 0 ++#endif ++#ifndef IUCLC ++#define IUCLC 0 ++#endif ++#ifndef IXANY ++#define IXANY 0 ++#endif ++#ifndef NLDLY ++#define NLDLY 0 ++#endif ++#ifndef OCRNL ++#define OCRNL 0 ++#endif ++#ifndef OFDEL ++#define OFDEL 0 ++#endif ++#ifndef OFILL ++#define OFILL 0 ++#endif ++#ifndef OLCUC ++#define OLCUC 0 ++#endif ++#ifndef ONLCR ++#define ONLCR 0 ++#endif ++#ifndef ONLRET ++#define ONLRET 0 ++#endif ++#ifndef ONOCR ++#define ONOCR 0 ++#endif ++#ifndef OXTABS ++#define OXTABS 0 ++#endif ++#ifndef TAB3 ++#define TAB3 0 ++#endif ++#ifndef TABDLY ++#define TABDLY 0 ++#endif ++#ifndef TOSTOP ++#define TOSTOP 0 ++#endif ++#ifndef VTDLY ++#define VTDLY 0 ++#endif ++#ifndef XCASE ++#define XCASE 0 ++#endif ++ + /* + * Reset the terminal mode bits to a sensible state. Very useful after + * a child program dies in raw mode. +@@ -195,6 +271,10 @@ out_char(int c) + void + reset_tty_settings(int fd, TTY * tty_settings, int noset) + { ++ unsigned mask; ++#ifdef TIOCMGET ++ int modem_bits; ++#endif + GET_TTY(fd, tty_settings); + + #ifdef TERMIOS +@@ -228,106 +308,65 @@ reset_tty_settings(int fd, TTY * tty_settings, int noset) + reset_char(VWERASE, CWERASE); + #endif + +- tty_settings->c_iflag &= ~((unsigned) (IGNBRK +- | PARMRK +- | INPCK +- | ISTRIP +- | INLCR +- | IGNCR +-#ifdef IUCLC +- | IUCLC +-#endif +-#ifdef IXANY +- | IXANY +-#endif +- | IXOFF)); +- +- tty_settings->c_iflag |= (BRKINT +- | IGNPAR +- | ICRNL +- | IXON +-#ifdef IMAXBEL +- | IMAXBEL +-#endif +- ); +- +- tty_settings->c_oflag &= ~((unsigned) (0 +-#ifdef OLCUC +- | OLCUC +-#endif +-#ifdef OCRNL +- | OCRNL +-#endif +-#ifdef ONOCR +- | ONOCR +-#endif +-#ifdef ONLRET +- | ONLRET +-#endif +-#ifdef OFILL +- | OFILL +-#endif +-#ifdef OFDEL +- | OFDEL +-#endif +-#ifdef NLDLY +- | NLDLY +-#endif +-#ifdef CRDLY +- | CRDLY +-#endif +-#ifdef TABDLY +- | TABDLY +-#endif +-#ifdef BSDLY +- | BSDLY +-#endif +-#ifdef VTDLY +- | VTDLY +-#endif +-#ifdef FFDLY +- | FFDLY +-#endif +- )); +- +- tty_settings->c_oflag |= (OPOST +-#ifdef ONLCR +- | ONLCR +-#endif +- ); +- +- tty_settings->c_cflag &= ~((unsigned) (CSIZE +- | CSTOPB +- | PARENB +- | PARODD +- | CLOCAL)); +- tty_settings->c_cflag |= (CS8 | CREAD); +- tty_settings->c_lflag &= ~((unsigned) (ECHONL +- | NOFLSH +-#ifdef TOSTOP +- | TOSTOP +-#endif +-#ifdef ECHOPTR +- | ECHOPRT +-#endif +-#ifdef XCASE +- | XCASE +-#endif +- )); +- +- tty_settings->c_lflag |= (ISIG +- | ICANON +- | ECHO +- | ECHOE +- | ECHOK +-#ifdef ECHOCTL +- | ECHOCTL +-#endif +-#ifdef ECHOKE +- | ECHOKE +-#endif +- ); +-#endif ++ clear_flags(tty_settings->c_iflag, (IGNBRK ++ | PARMRK ++ | INPCK ++ | ISTRIP ++ | INLCR ++ | IGNCR ++ | IUCLC ++ | IXANY ++ | IXOFF)); ++ ++ set_flags(tty_settings->c_iflag, (BRKINT ++ | IGNPAR ++ | ICRNL ++ | IXON ++ | IMAXBEL)); ++ ++ clear_flags(tty_settings->c_oflag, (0 ++ | OLCUC ++ | OCRNL ++ | ONOCR ++ | ONLRET ++ | OFILL ++ | OFDEL ++ | NLDLY ++ | CRDLY ++ | TABDLY ++ | BSDLY ++ | VTDLY ++ | FFDLY)); ++ ++ set_flags(tty_settings->c_oflag, (OPOST ++ | ONLCR)); ++ ++ mask = (CSIZE | CSTOPB | PARENB | PARODD); ++#ifdef TIOCMGET ++ /* leave clocal alone if this appears to use a modem */ ++ if (ioctl(fd, TIOCMGET, &modem_bits) == -1) ++ mask |= CLOCAL; ++#else ++ /* cannot check - use the behavior from tset */ ++ mask |= CLOCAL; ++#endif ++ clear_flags(tty_settings->c_cflag, mask); ++ ++ set_flags(tty_settings->c_cflag, (CS8 | CREAD)); ++ clear_flags(tty_settings->c_lflag, (ECHONL ++ | NOFLSH ++ | TOSTOP ++ | ECHOPRT ++ | XCASE)); ++ ++ set_flags(tty_settings->c_lflag, (ISIG ++ | ICANON ++ | ECHO ++ | ECHOE ++ | ECHOK ++ | ECHOCTL ++ | ECHOKE)); ++#endif /* TERMIOS */ + + if (!noset) { + SET_TTY(fd, tty_settings); +@@ -402,29 +441,23 @@ set_conversions(TTY * tty_settings) + #if defined(EXP_WIN32_DRIVER) + /* FIXME */ + #else +-#ifdef ONLCR +- tty_settings->c_oflag |= ONLCR; +-#endif +- tty_settings->c_iflag |= ICRNL; +- tty_settings->c_lflag |= ECHO; +-#ifdef OXTABS +- tty_settings->c_oflag |= OXTABS; +-#endif /* OXTABS */ ++ set_flags(tty_settings->c_oflag, ONLCR); ++ set_flags(tty_settings->c_iflag, ICRNL); ++ set_flags(tty_settings->c_lflag, ECHO); ++ set_flags(tty_settings->c_oflag, OXTABS); + + /* test used to be tgetflag("NL") */ + if (VALID_STRING(newline) && newline[0] == '\n' && !newline[1]) { + /* Newline, not linefeed. */ +-#ifdef ONLCR +- tty_settings->c_oflag &= ~((unsigned) ONLCR); +-#endif +- tty_settings->c_iflag &= ~((unsigned) ICRNL); ++ clear_flags(tty_settings->c_oflag, ONLCR); ++ clear_flags(tty_settings->c_iflag, ICRNL); + } +-#ifdef OXTABS ++#if OXTABS + /* test used to be tgetflag("pt") */ + if (VALID_STRING(set_tab) && VALID_STRING(clear_all_tabs)) +- tty_settings->c_oflag &= ~OXTABS; ++ clear_flags(tty_settings->c_oflag, OXTABS); + #endif /* OXTABS */ +- tty_settings->c_lflag |= (ECHOE | ECHOK); ++ set_flags(tty_settings->c_lflag, (ECHOE | ECHOK)); + #endif + } + +@@ -490,7 +523,7 @@ send_init_strings(int fd GCC_UNUSED, TTY * old_settings) + bool need_flush = FALSE; + + (void) old_settings; +-#ifdef TAB3 ++#if TAB3 + if (old_settings != 0 && + old_settings->c_oflag & (TAB3 | ONLCR | OCRNL | ONLRET)) { + old_settings->c_oflag &= (TAB3 | ONLCR | OCRNL | ONLRET); +@@ -512,22 +545,22 @@ send_init_strings(int fd GCC_UNUSED, TTY * old_settings) + + if (VALID_STRING(clear_margins)) { + need_flush |= sent_string(clear_margins); +- } else ++ } + #if defined(set_lr_margin) +- if (VALID_STRING(set_lr_margin)) { ++ else if (VALID_STRING(set_lr_margin)) { + need_flush |= sent_string(TIPARM_2(set_lr_margin, 0, columns - 1)); +- } else ++ } + #endif + #if defined(set_left_margin_parm) && defined(set_right_margin_parm) +- if (VALID_STRING(set_left_margin_parm) +- && VALID_STRING(set_right_margin_parm)) { ++ else if (VALID_STRING(set_left_margin_parm) ++ && VALID_STRING(set_right_margin_parm)) { + need_flush |= sent_string(TIPARM_1(set_left_margin_parm, 0)); + need_flush |= sent_string(TIPARM_1(set_right_margin_parm, + columns - 1)); +- } else ++ } + #endif +- if (VALID_STRING(set_left_margin) +- && VALID_STRING(set_right_margin)) { ++ else if (VALID_STRING(set_left_margin) ++ && VALID_STRING(set_right_margin)) { + need_flush |= to_left_margin(); + need_flush |= sent_string(set_left_margin); + if (VALID_STRING(parm_right_cursor)) { +diff --git a/progs/tabs.c b/progs/tabs.c +index 7378d116..d904330b 100644 +--- a/progs/tabs.c ++++ b/progs/tabs.c +@@ -370,7 +370,9 @@ do_set_margin(int margin, bool no_op) + } + tputs(set_left_margin, 1, putch); + } +- } else if (VALID_STRING(set_left_margin_parm)) { ++ } ++#if defined(set_left_margin_parm) && defined(set_right_margin_parm) ++ else if (VALID_STRING(set_left_margin_parm)) { + result = TRUE; + if (!no_op) { + if (VALID_STRING(set_right_margin_parm)) { +@@ -379,12 +381,16 @@ do_set_margin(int margin, bool no_op) + tputs(TIPARM_2(set_left_margin_parm, margin, max_cols), 1, putch); + } + } +- } else if (VALID_STRING(set_lr_margin)) { ++ } ++#endif ++#if defined(set_lr_margin) ++ else if (VALID_STRING(set_lr_margin)) { + result = TRUE; + if (!no_op) { + tputs(TIPARM_2(set_lr_margin, margin, max_cols), 1, putch); + } + } ++#endif + return result; + } + +diff --git a/progs/tic.c b/progs/tic.c +index 888927e2..78b568fa 100644 +--- a/progs/tic.c ++++ b/progs/tic.c +@@ -3142,6 +3142,7 @@ guess_ANSI_VTxx(TERMTYPE2 *tp) + * In particular, any ECMA-48 terminal should support these, though the details + * for u9 are implementation dependent. + */ ++#if defined(user6) && defined(user7) && defined(user8) && defined(user9) + static void + check_user_6789(TERMTYPE2 *tp) + { +@@ -3177,6 +3178,9 @@ check_user_6789(TERMTYPE2 *tp) + break; + } + } ++#else ++#define check_user_6789(tp) /* nothing */ ++#endif + + /* other sanity-checks (things that we don't want in the normal + * logic that reads a terminfo entry) +-- +2.40.0 diff --git a/meta/recipes-core/ncurses/files/0001-tic-hang.patch b/meta/recipes-core/ncurses/files/0001-tic-hang.patch index 4a970561d7..f98a943e5c 100644 --- a/meta/recipes-core/ncurses/files/0001-tic-hang.patch +++ b/meta/recipes-core/ncurses/files/0001-tic-hang.patch @@ -1,6 +1,6 @@ -From a95590f676209832fe0b27226e6de3cb50e2b97c Mon Sep 17 00:00:00 2001 +From 168ba7a681be73ac024438e33e14fde1d5aea97d Mon Sep 17 00:00:00 2001 From: Hongxu Jia <hongxu.jia@windriver.com> -Date: Wed, 16 Aug 2017 14:31:51 +0800 +Date: Fri, 30 Mar 2018 10:02:24 +0800 Subject: [PATCH 1/2] tic hang Upstream-Status: Inappropriate [configuration] @@ -10,34 +10,34 @@ loop when processing the original file. Signed-off-by: anonymous -Rebase to 6.0+20170715 +Rebase to 6.1 Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> --- misc/terminfo.src | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/misc/terminfo.src b/misc/terminfo.src -index ee3fab3..176d593 100644 +index 84f4810..6b385ec 100644 --- a/misc/terminfo.src +++ b/misc/terminfo.src -@@ -5177,12 +5177,11 @@ konsole-xf3x|KDE console window with keyboard for XFree86 3.x xterm, - # The value for kbs reflects local customization rather than the settings used - # for XFree86 xterm. +@@ -5562,12 +5562,11 @@ konsole-xf3x|KDE console window with keyboard for XFree86 3.x xterm, + # The value for kbs (see konsole-vt100) reflects local customization rather + # than the settings used for XFree86 xterm. konsole-xf4x|KDE console window with keyboard for XFree86 4.x xterm, - kend=\EOF, khome=\EOH, use=konsole+pcfkeys, - use=konsole-vt100, --# Konsole does not implement shifted cursor-keys. +- -konsole+pcfkeys|konsole subset of xterm+pcfkeys, -- kLFT@, kRIT@, kcbt=\E[Z, kind@, kri@, kDN@, kUP@, use=xterm+pcc2, -- use=xterm+pcf0, +- kcbt=\E[Z, use=xterm+pcc2, use=xterm+pcf0, +- use=xterm+pce2, + kend=\EOF, kf1=\EOP, kf13=\EO2P, kf14=\EO2Q, kf15=\EO2R, + kf16=\EO2S, kf17=\E[15;2~, kf18=\E[17;2~, kf19=\E[18;2~, + kf2=\EOQ, kf20=\E[19;2~, kf21=\E[20;2~, kf22=\E[21;2~, + kf23=\E[23;2~, kf24=\E[24;2~, kf3=\EOR, kf4=\EOS, + khome=\EOH, use=konsole-vt100, + + # Obsolete: vt100.keymap # KDE's "vt100" keyboard has no relationship to any terminal that DEC made, but - # it is still useful for deriving the other entries. - konsole-vt100|KDE console window with vt100 (sic) keyboard, -- 1.8.3.1 diff --git a/meta/recipes-core/ncurses/files/0002-configure-reproducible.patch b/meta/recipes-core/ncurses/files/0002-configure-reproducible.patch index c47ce6a8cb..66f26c06ab 100644 --- a/meta/recipes-core/ncurses/files/0002-configure-reproducible.patch +++ b/meta/recipes-core/ncurses/files/0002-configure-reproducible.patch @@ -1,7 +1,7 @@ -From 939c994f3756c2d6d3cab2e6a04d05fa7c2b1d56 Mon Sep 17 00:00:00 2001 +From ec87e53066a9942e9aaba817d71268342f5e83b9 Mon Sep 17 00:00:00 2001 From: Hongxu Jia <hongxu.jia@windriver.com> Date: Wed, 16 Aug 2017 14:45:27 +0800 -Subject: [PATCH 2/2] configure: reproducible +Subject: [PATCH] configure: reproducible "configure" enforces -U for ar flags, breaking deterministic builds. The flag was added to fix some vaguely specified "recent POSIX binutil @@ -10,26 +10,24 @@ build problems" in 2015. Upstream-Status: Pending Signed-off-by: Juro Bystricky <juro.bystricky@intel.com> -Rebase to Rebase to 6.0+20170715 +Rebase to 6.1 Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> + --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure -index 7d7d2c1..f444354 100755 +index 421cf859..a1b7840d 100755 --- a/configure +++ b/configure -@@ -4458,7 +4458,7 @@ if test "${cf_cv_ar_flags+set}" = set; then - else - - cf_cv_ar_flags=unknown -- for cf_ar_flags in -curvU -curv curv -crv crv -cqv cqv -rv rv -+ for cf_ar_flags in -curv curv -crv crv -cqv cqv -rv rv - do +@@ -5072,7 +5072,7 @@ else + ;; + (*) + cf_cv_ar_flags=unknown +- for cf_ar_flags in -curvU -curv curv -crv crv -cqv cqv -rv rv ++ for cf_ar_flags in -curv curv -crv crv -cqv cqv -rv rv + do - # check if $ARFLAGS already contains this choice --- -1.8.3.1 - + # check if $ARFLAGS already contains this choice diff --git a/meta/recipes-core/ncurses/files/0003-gen-pkgconfig.in-Do-not-include-LDFLAGS-in-generated.patch b/meta/recipes-core/ncurses/files/0003-gen-pkgconfig.in-Do-not-include-LDFLAGS-in-generated.patch new file mode 100644 index 0000000000..a15694d4d4 --- /dev/null +++ b/meta/recipes-core/ncurses/files/0003-gen-pkgconfig.in-Do-not-include-LDFLAGS-in-generated.patch @@ -0,0 +1,30 @@ +From 10cd0c12a6e14fb4f0498c299c1dd32720b710da Mon Sep 17 00:00:00 2001 +From: Nathan Rossi <nathan@nathanrossi.com> +Date: Mon, 14 Dec 2020 13:39:02 +1000 +Subject: [PATCH] gen-pkgconfig.in: Do not include LDFLAGS in generated pc + files + +Including the LDFLAGS in the pkgconfig output is problematic as OE +includes build host specific paths and options (e.g. uninative and +'-Wl,--dynamic-linker='). + +Upstream-Status: Inappropriate [OE Specific] +Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> + +--- + misc/gen-pkgconfig.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/misc/gen-pkgconfig.in b/misc/gen-pkgconfig.in +index a45dd54f..85273054 100644 +--- a/misc/gen-pkgconfig.in ++++ b/misc/gen-pkgconfig.in +@@ -83,7 +83,7 @@ if [ "$includedir" != "/usr/include" ]; then + fi + + lib_flags= +-for opt in -L$libdir @EXTRA_PKG_LDFLAGS@ @LIBS@ ++for opt in -L$libdir @LIBS@ + do + case $opt in + -l*) # LIBS is handled specially below diff --git a/meta/recipes-core/ncurses/files/CVE-2017-13732-CVE-2017-13734-CVE-2017-13730-CVE-2017-13729-CVE-2017-13728-CVE-2017-13731.patch b/meta/recipes-core/ncurses/files/CVE-2017-13732-CVE-2017-13734-CVE-2017-13730-CVE-2017-13729-CVE-2017-13728-CVE-2017-13731.patch deleted file mode 100644 index a19332c4b2..0000000000 --- a/meta/recipes-core/ncurses/files/CVE-2017-13732-CVE-2017-13734-CVE-2017-13730-CVE-2017-13729-CVE-2017-13728-CVE-2017-13731.patch +++ /dev/null @@ -1,541 +0,0 @@ -From 4bf72cb8f1d3aa5f33c31eb817a5f0338f4aaf6f Mon Sep 17 00:00:00 2001 -From: Ovidiu Panait <ovidiu.panait@windriver.com> -Date: Wed, 20 Sep 2017 05:02:00 +0000 -Subject: [PATCH] Import upstream patch 20170826 - -20170826 - + fixes for "iterm2" (report by Leonardo Brondani Schenkel) -TD - + corrected a warning from tic about keys which are the same, to skip - over missing/cancelled values. - + add check in tic for unnecessary use of "2" to denote a shifted - special key. - + improve checks in trim_sgr0, comp_parse.c and parse_entry.c, for - cancelled string capabilities. - + add check in _nc_parse_entry() for invalid entry name, setting the - name to "invalid" to avoid problems storing entries. - + add/improve checks in tic's parser to address invalid input - + add a check in comp_scan.c to handle the special case where a - nontext file ending with a NUL rather than newline is given to tic - as input (Redhat #1484274). - + allow for cancelled capabilities in _nc_save_str (Redhat #1484276). - + add validity checks for "use=" target in _nc_parse_entry (Redhat - #1484284). - + check for invalid strings in postprocess_termcap (Redhat #1484285) - + reset secondary pointers on EOF in next_char() (Redhat #1484287). - + guard _nc_safe_strcpy() and _nc_safe_strcat() against calls using - cancelled strings (Redhat #1484291). - + correct typo in curs_memleaks.3x (Sven Joachim). - + improve test/configure checks for some curses variants not based on - X/Open Curses. - + add options for test/configure to disable checks for form, menu and - panel libraries. - -Upstream-Status: Backport -CVE: CVE-2017-13732, CVE-2017-13734, CVE-2017-13730, CVE-2017-13729, CVE-2017-13728, CVE-2017-13731 - - -Author: Sven Joachim <svenjoac@gmx.de> -Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> ---- - dist.mk | 4 +- - include/ncurses_defs | 4 +- - ncurses/tinfo/alloc_entry.c | 4 +- - ncurses/tinfo/comp_parse.c | 10 ++--- - ncurses/tinfo/comp_scan.c | 6 ++- - ncurses/tinfo/parse_entry.c | 91 ++++++++++++++++++++++++++++++--------------- - ncurses/tinfo/strings.c | 9 +++-- - ncurses/tinfo/trim_sgr0.c | 4 +- - progs/tic.c | 75 ++++++++++++++++++++++++++++++++++++- - 9 files changed, 157 insertions(+), 50 deletions(-) - -diff --git a/dist.mk b/dist.mk -index 9af2699..2c70472 100644 ---- a/dist.mk -+++ b/dist.mk -@@ -25,7 +25,7 @@ - # use or other dealings in this Software without prior written # - # authorization. # - ############################################################################## --# $Id: dist.mk,v 1.1172 2017/07/13 00:15:27 tom Exp $ -+# $Id: dist.mk,v 1.1179 2017/08/20 15:33:41 tom Exp $ - # Makefile for creating ncurses distributions. - # - # This only needs to be used directly as a makefile by developers, but -@@ -37,7 +37,7 @@ SHELL = /bin/sh - # These define the major/minor/patch versions of ncurses. - NCURSES_MAJOR = 6 - NCURSES_MINOR = 0 --NCURSES_PATCH = 20170715 -+NCURSES_PATCH = 20170826 - - # We don't append the patch to the version, since this only applies to releases - VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) -diff --git a/include/ncurses_defs b/include/ncurses_defs -index e6611b7..d237db1 100644 ---- a/include/ncurses_defs -+++ b/include/ncurses_defs -@@ -1,4 +1,4 @@ --# $Id: ncurses_defs,v 1.73 2017/06/24 14:20:57 tom Exp $ -+# $Id: ncurses_defs,v 1.75 2017/08/20 16:50:04 tom Exp $ - ############################################################################## - # Copyright (c) 2000-2016,2017 Free Software Foundation, Inc. # - # # -@@ -50,7 +50,9 @@ HAVE_BSD_STRING_H - HAVE_BTOWC - HAVE_BUILTIN_H - HAVE_CHGAT 1 -+HAVE_COLOR_CONTENT 1 - HAVE_COLOR_SET 1 -+HAVE_CURSCR 1 - HAVE_DIRENT_H - HAVE_ERRNO - HAVE_FCNTL_H -diff --git a/ncurses/tinfo/alloc_entry.c b/ncurses/tinfo/alloc_entry.c -index 5de09f1..09374d6 100644 ---- a/ncurses/tinfo/alloc_entry.c -+++ b/ncurses/tinfo/alloc_entry.c -@@ -47,7 +47,7 @@ - - #include <tic.h> - --MODULE_ID("$Id: alloc_entry.c,v 1.60 2017/06/27 23:48:55 tom Exp $") -+MODULE_ID("$Id: alloc_entry.c,v 1.61 2017/08/25 09:09:08 tom Exp $") - - #define ABSENT_OFFSET -1 - #define CANCELLED_OFFSET -2 -@@ -98,7 +98,7 @@ _nc_save_str(const char *const string) - size_t old_next_free = next_free; - size_t len; - -- if (string == 0) -+ if (!VALID_STRING(string)) - return _nc_save_str(""); - len = strlen(string) + 1; - -diff --git a/ncurses/tinfo/comp_parse.c b/ncurses/tinfo/comp_parse.c -index 34e6216..580d4df 100644 ---- a/ncurses/tinfo/comp_parse.c -+++ b/ncurses/tinfo/comp_parse.c -@@ -47,7 +47,7 @@ - - #include <tic.h> - --MODULE_ID("$Id: comp_parse.c,v 1.96 2017/04/15 15:36:58 tom Exp $") -+MODULE_ID("$Id: comp_parse.c,v 1.99 2017/08/26 16:15:50 tom Exp $") - - static void sanity_check2(TERMTYPE2 *, bool); - NCURSES_IMPEXP void NCURSES_API(*_nc_check_termtype2) (TERMTYPE2 *, bool) = sanity_check2; -@@ -510,9 +510,9 @@ static void - fixup_acsc(TERMTYPE2 *tp, int literal) - { - if (!literal) { -- if (acs_chars == 0 -- && enter_alt_charset_mode != 0 -- && exit_alt_charset_mode != 0) -+ if (acs_chars == ABSENT_STRING -+ && PRESENT(enter_alt_charset_mode) -+ && PRESENT(exit_alt_charset_mode)) - acs_chars = strdup(VT_ACSC); - } - } -@@ -568,9 +568,7 @@ sanity_check2(TERMTYPE2 *tp, bool literal) - PAIRED(enter_xon_mode, exit_xon_mode); - PAIRED(enter_am_mode, exit_am_mode); - ANDMISSING(label_off, label_on); --#ifdef remove_clock - PAIRED(display_clock, remove_clock); --#endif - ANDMISSING(set_color_pair, initialize_pair); - } - -diff --git a/ncurses/tinfo/comp_scan.c b/ncurses/tinfo/comp_scan.c -index 40d7f6a..b207257 100644 ---- a/ncurses/tinfo/comp_scan.c -+++ b/ncurses/tinfo/comp_scan.c -@@ -50,7 +50,7 @@ - #include <ctype.h> - #include <tic.h> - --MODULE_ID("$Id: comp_scan.c,v 1.106 2017/04/22 11:41:12 tom Exp $") -+MODULE_ID("$Id: comp_scan.c,v 1.108 2017/08/25 22:57:21 tom Exp $") - - /* - * Maximum length of string capability we'll accept before raising an error. -@@ -168,6 +168,8 @@ next_char(void) - if (result != 0) { - FreeAndNull(result); - FreeAndNull(pushname); -+ bufptr = 0; -+ bufstart = 0; - allocated = 0; - } - /* -@@ -222,6 +224,8 @@ next_char(void) - } - if ((bufptr = bufstart) != 0) { - used = strlen(bufptr); -+ if (used == 0) -+ return (EOF); - while (iswhite(*bufptr)) { - if (*bufptr == '\t') { - _nc_curr_col = (_nc_curr_col | 7) + 1; -diff --git a/ncurses/tinfo/parse_entry.c b/ncurses/tinfo/parse_entry.c -index 3fa2f25..bbbfcb2 100644 ---- a/ncurses/tinfo/parse_entry.c -+++ b/ncurses/tinfo/parse_entry.c -@@ -47,7 +47,7 @@ - #include <ctype.h> - #include <tic.h> - --MODULE_ID("$Id: parse_entry.c,v 1.86 2017/06/28 00:53:12 tom Exp $") -+MODULE_ID("$Id: parse_entry.c,v 1.91 2017/08/26 16:13:34 tom Exp $") - - #ifdef LINT - static short const parametrized[] = -@@ -180,6 +180,20 @@ _nc_extend_names(ENTRY * entryp, char *name, int token_type) - } - #endif /* NCURSES_XNAMES */ - -+static bool -+valid_entryname(const char *name) -+{ -+ bool result = TRUE; -+ int ch; -+ while ((ch = UChar(*name++)) != '\0') { -+ if (ch <= ' ' || ch > '~' || ch == '/') { -+ result = FALSE; -+ break; -+ } -+ } -+ return result; -+} -+ - /* - * int - * _nc_parse_entry(entry, literal, silent) -@@ -211,6 +225,7 @@ _nc_parse_entry(ENTRY * entryp, int literal, bool silent) - int token_type; - struct name_table_entry const *entry_ptr; - char *ptr, *base; -+ const char *name; - bool bad_tc_usage = FALSE; - - token_type = _nc_get_token(silent); -@@ -261,7 +276,12 @@ _nc_parse_entry(ENTRY * entryp, int literal, bool silent) - * results in the terminal type getting prematurely set to correspond - * to that of the next entry. - */ -- _nc_set_type(_nc_first_name(entryp->tterm.term_names)); -+ name = _nc_first_name(entryp->tterm.term_names); -+ if (!valid_entryname(name)) { -+ _nc_warning("invalid entry name \"%s\"", name); -+ name = "invalid"; -+ } -+ _nc_set_type(name); - - /* check for overly-long names and aliases */ - for (base = entryp->tterm.term_names; (ptr = strchr(base, '|')) != 0; -@@ -283,13 +303,24 @@ _nc_parse_entry(ENTRY * entryp, int literal, bool silent) - bool is_use = (strcmp(_nc_curr_token.tk_name, "use") == 0); - bool is_tc = !is_use && (strcmp(_nc_curr_token.tk_name, "tc") == 0); - if (is_use || is_tc) { -+ if (!VALID_STRING(_nc_curr_token.tk_valstring) -+ || _nc_curr_token.tk_valstring[0] == '\0') { -+ _nc_warning("missing name for use-clause"); -+ continue; -+ } else if (!valid_entryname(_nc_curr_token.tk_valstring)) { -+ _nc_warning("invalid name for use-clause \"%s\"", -+ _nc_curr_token.tk_valstring); -+ continue; -+ } else if (entryp->nuses >= MAX_USES) { -+ _nc_warning("too many use-clauses, ignored \"%s\"", -+ _nc_curr_token.tk_valstring); -+ continue; -+ } - entryp->uses[entryp->nuses].name = _nc_save_str(_nc_curr_token.tk_valstring); - entryp->uses[entryp->nuses].line = _nc_curr_line; -- if (VALID_STRING(entryp->uses[entryp->nuses].name)) { -- entryp->nuses++; -- if (entryp->nuses > 1 && is_tc) { -- BAD_TC_USAGE -- } -+ entryp->nuses++; -+ if (entryp->nuses > 1 && is_tc) { -+ BAD_TC_USAGE - } - } else { - /* normal token lookup */ -@@ -641,13 +672,6 @@ static const char C_BS[] = "\b"; - static const char C_HT[] = "\t"; - - /* -- * Note that WANTED and PRESENT are not simple inverses! If a capability -- * has been explicitly cancelled, it's not considered WANTED. -- */ --#define WANTED(s) ((s) == ABSENT_STRING) --#define PRESENT(s) (((s) != ABSENT_STRING) && ((s) != CANCELLED_STRING)) -- --/* - * This bit of legerdemain turns all the terminfo variable names into - * references to locations in the arrays Booleans, Numbers, and Strings --- - * precisely what's needed. -@@ -672,10 +696,10 @@ postprocess_termcap(TERMTYPE2 *tp, bool has_base) - - /* if there was a tc entry, assume we picked up defaults via that */ - if (!has_base) { -- if (WANTED(init_3string) && termcap_init2) -+ if (WANTED(init_3string) && PRESENT(termcap_init2)) - init_3string = _nc_save_str(termcap_init2); - -- if (WANTED(reset_2string) && termcap_reset) -+ if (WANTED(reset_2string) && PRESENT(termcap_reset)) - reset_2string = _nc_save_str(termcap_reset); - - if (WANTED(carriage_return)) { -@@ -790,7 +814,7 @@ postprocess_termcap(TERMTYPE2 *tp, bool has_base) - if (init_tabs != 8 && init_tabs != ABSENT_NUMERIC) - _nc_warning("hardware tabs with a width other than 8: %d", init_tabs); - else { -- if (tab && _nc_capcmp(tab, C_HT)) -+ if (PRESENT(tab) && _nc_capcmp(tab, C_HT)) - _nc_warning("hardware tabs with a non-^I tab string %s", - _nc_visbuf(tab)); - else { -@@ -867,17 +891,22 @@ postprocess_termcap(TERMTYPE2 *tp, bool has_base) - * The magic moment -- copy the mapped key string over, - * stripping out padding. - */ -- for (dp = buf2, bp = tp->Strings[from_ptr->nte_index]; *bp; bp++) { -- if (bp[0] == '$' && bp[1] == '<') { -- while (*bp && *bp != '>') { -- ++bp; -- } -- } else -- *dp++ = *bp; -- } -- *dp = '\0'; -+ bp = tp->Strings[from_ptr->nte_index]; -+ if (VALID_STRING(bp)) { -+ for (dp = buf2; *bp; bp++) { -+ if (bp[0] == '$' && bp[1] == '<') { -+ while (*bp && *bp != '>') { -+ ++bp; -+ } -+ } else -+ *dp++ = *bp; -+ } -+ *dp = '\0'; - -- tp->Strings[to_ptr->nte_index] = _nc_save_str(buf2); -+ tp->Strings[to_ptr->nte_index] = _nc_save_str(buf2); -+ } else { -+ tp->Strings[to_ptr->nte_index] = bp; -+ } - } - - /* -@@ -886,7 +915,7 @@ postprocess_termcap(TERMTYPE2 *tp, bool has_base) - * got mapped to kich1 and im to kIC to avoid a collision. - * If the description has im but not ic, hack kIC back to kich1. - */ -- if (foundim && WANTED(key_ic) && key_sic) { -+ if (foundim && WANTED(key_ic) && PRESENT(key_sic)) { - key_ic = key_sic; - key_sic = ABSENT_STRING; - } -@@ -938,9 +967,9 @@ postprocess_termcap(TERMTYPE2 *tp, bool has_base) - acs_chars = _nc_save_str(buf2); - _nc_warning("acsc string synthesized from XENIX capabilities"); - } -- } else if (acs_chars == 0 -- && enter_alt_charset_mode != 0 -- && exit_alt_charset_mode != 0) { -+ } else if (acs_chars == ABSENT_STRING -+ && PRESENT(enter_alt_charset_mode) -+ && PRESENT(exit_alt_charset_mode)) { - acs_chars = _nc_save_str(VT_ACSC); - } - } -diff --git a/ncurses/tinfo/strings.c b/ncurses/tinfo/strings.c -index 393d8e7..10ec6c8 100644 ---- a/ncurses/tinfo/strings.c -+++ b/ncurses/tinfo/strings.c -@@ -1,5 +1,5 @@ - /**************************************************************************** -- * Copyright (c) 2000-2007,2012 Free Software Foundation, Inc. * -+ * Copyright (c) 2000-2012,2017 Free Software Foundation, Inc. * - * * - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * -@@ -35,8 +35,9 @@ - **/ - - #include <curses.priv.h> -+#include <tic.h> - --MODULE_ID("$Id: strings.c,v 1.8 2012/02/22 22:34:31 tom Exp $") -+MODULE_ID("$Id: strings.c,v 1.9 2017/08/26 13:16:11 tom Exp $") - - /**************************************************************************** - * Useful string functions (especially for mvcur) -@@ -105,7 +106,7 @@ _nc_str_copy(string_desc * dst, string_desc * src) - NCURSES_EXPORT(bool) - _nc_safe_strcat(string_desc * dst, const char *src) - { -- if (src != 0) { -+ if (PRESENT(src)) { - size_t len = strlen(src); - - if (len < dst->s_size) { -@@ -126,7 +127,7 @@ _nc_safe_strcat(string_desc * dst, const char *src) - NCURSES_EXPORT(bool) - _nc_safe_strcpy(string_desc * dst, const char *src) - { -- if (src != 0) { -+ if (PRESENT(src)) { - size_t len = strlen(src); - - if (len < dst->s_size) { -diff --git a/ncurses/tinfo/trim_sgr0.c b/ncurses/tinfo/trim_sgr0.c -index 4cbcb65..4d92d15 100644 ---- a/ncurses/tinfo/trim_sgr0.c -+++ b/ncurses/tinfo/trim_sgr0.c -@@ -36,7 +36,7 @@ - - #include <tic.h> - --MODULE_ID("$Id: trim_sgr0.c,v 1.16 2017/04/05 22:33:07 tom Exp $") -+MODULE_ID("$Id: trim_sgr0.c,v 1.17 2017/08/26 14:54:16 tom Exp $") - - #undef CUR - #define CUR tp-> -@@ -263,7 +263,7 @@ _nc_trim_sgr0(TERMTYPE2 *tp) - /* - * If rmacs is a substring of sgr(0), remove that chunk. - */ -- if (exit_alt_charset_mode != 0) { -+ if (PRESENT(exit_alt_charset_mode)) { - TR(TRACE_DATABASE, ("scan for rmacs %s", _nc_visbuf(exit_alt_charset_mode))); - j = strlen(off); - k = strlen(exit_alt_charset_mode); -diff --git a/progs/tic.c b/progs/tic.c -index c5d78e5..6dd4678 100644 ---- a/progs/tic.c -+++ b/progs/tic.c -@@ -48,7 +48,7 @@ - #include <parametrized.h> - #include <transform.h> - --MODULE_ID("$Id: tic.c,v 1.233 2017/07/15 17:40:19 tom Exp $") -+MODULE_ID("$Id: tic.c,v 1.243 2017/08/26 20:56:55 tom Exp $") - - #define STDIN_NAME "<stdin>" - -@@ -62,6 +62,10 @@ static bool showsummary = FALSE; - static char **namelst = 0; - static const char *to_remove; - -+#if NCURSES_XNAMES -+static bool using_extensions = FALSE; -+#endif -+ - static void (*save_check_termtype) (TERMTYPE2 *, bool); - static void check_termtype(TERMTYPE2 *tt, bool); - -@@ -850,6 +854,7 @@ main(int argc, char *argv[]) - /* FALLTHRU */ - case 'x': - use_extended_names(TRUE); -+ using_extensions = TRUE; - break; - #endif - default: -@@ -2405,10 +2410,17 @@ check_conflict(TERMTYPE2 *tp) - const char *a = given[j].value; - bool first = TRUE; - -+ if (!VALID_STRING(a)) -+ continue; -+ - for (k = j + 1; given[k].keycode; k++) { - const char *b = given[k].value; -+ -+ if (!VALID_STRING(b)) -+ continue; - if (check[k]) - continue; -+ - if (!_nc_capcmp(a, b)) { - check[j] = 1; - check[k] = 1; -@@ -2431,6 +2443,67 @@ check_conflict(TERMTYPE2 *tp) - if (!first) - fprintf(stderr, "\n"); - } -+#if NCURSES_XNAMES -+ if (using_extensions) { -+ /* *INDENT-OFF* */ -+ static struct { -+ const char *xcurses; -+ const char *shifted; -+ } table[] = { -+ { "kDC", NULL }, -+ { "kDN", "kind" }, -+ { "kEND", NULL }, -+ { "kHOM", NULL }, -+ { "kLFT", NULL }, -+ { "kNXT", NULL }, -+ { "kPRV", NULL }, -+ { "kRIT", NULL }, -+ { "kUP", "kri" }, -+ { NULL, NULL }, -+ }; -+ /* *INDENT-ON* */ -+ -+ /* -+ * SVr4 curses defines the "xcurses" names listed above except for -+ * the special cases in the "shifted" column. When using these -+ * names for xterm's extensions, that was confusing, and resulted -+ * in adding extended capabilities with "2" (shift) suffix. This -+ * check warns about unnecessary use of extensions for this quirk. -+ */ -+ for (j = 0; given[j].keycode; ++j) { -+ const char *find = given[j].name; -+ int value; -+ char ch; -+ -+ if (!VALID_STRING(given[j].value)) -+ continue; -+ -+ for (k = 0; table[k].xcurses; ++k) { -+ const char *test = table[k].xcurses; -+ size_t size = strlen(test); -+ -+ if (!strncmp(find, test, size) && strcmp(find, test)) { -+ switch (sscanf(find + size, "%d%c", &value, &ch)) { -+ case 1: -+ if (value == 2) { -+ _nc_warning("expected '%s' rather than '%s'", -+ (table[k].shifted -+ ? table[k].shifted -+ : test), find); -+ } else if (value < 2 || value > 15) { -+ _nc_warning("expected numeric 2..15 '%s'", find); -+ } -+ break; -+ default: -+ _nc_warning("expected numeric suffix for '%s'", find); -+ break; -+ } -+ break; -+ } -+ } -+ } -+ } -+#endif - free(given); - free(check); - } --- -2.10.2 - diff --git a/meta/recipes-core/ncurses/files/CVE-2023-45918.patch b/meta/recipes-core/ncurses/files/CVE-2023-45918.patch new file mode 100644 index 0000000000..fbdae49a61 --- /dev/null +++ b/meta/recipes-core/ncurses/files/CVE-2023-45918.patch @@ -0,0 +1,180 @@ +From bcf02d3242f1c7d57224a95f7903fcf4b5e7695d Mon Sep 17 00:00:00 2001 +From: Thomas E. Dickey <dickey@invisible-island.net> +Date: Fri, 16 Jun 2023 02:54:29 +0530 +Subject: [PATCH] Fix CVE-2023-45918 + +CVE: CVE-2023-45918 + +Upstream-Status: Backport [https://ncurses.scripts.mit.edu/?p=ncurses.git;a=commit;h=bcf02d3242f1c7d57224a95f7903fcf4b5e7695d] + +Signed-off-by: Soumya Sambu <soumya.sambu@windriver.com> +--- + ncurses/tinfo/comp_error.c | 15 ++++++--- + ncurses/tinfo/read_entry.c | 65 ++++++++++++++++++++++++++------------ + 2 files changed, 56 insertions(+), 24 deletions(-) + +diff --git a/ncurses/tinfo/comp_error.c b/ncurses/tinfo/comp_error.c +index 48f48784..ee518e28 100644 +--- a/ncurses/tinfo/comp_error.c ++++ b/ncurses/tinfo/comp_error.c +@@ -60,8 +60,15 @@ _nc_get_source(void) + NCURSES_EXPORT(void) + _nc_set_source(const char *const name) + { +- FreeIfNeeded(SourceName); +- SourceName = strdup(name); ++ if (name == NULL) { ++ free(SourceName); ++ SourceName = NULL; ++ } else if (SourceName == NULL) { ++ SourceName = strdup(name); ++ } else if (strcmp(name, SourceName)) { ++ free(SourceName); ++ SourceName = strdup(name); ++ } + } + + NCURSES_EXPORT(void) +@@ -95,9 +102,9 @@ static NCURSES_INLINE void + where_is_problem(void) + { + fprintf(stderr, "\"%s\"", SourceName ? SourceName : "?"); +- if (_nc_curr_line >= 0) ++ if (_nc_curr_line > 0) + fprintf(stderr, ", line %d", _nc_curr_line); +- if (_nc_curr_col >= 0) ++ if (_nc_curr_col > 0) + fprintf(stderr, ", col %d", _nc_curr_col); + if (TermType != 0 && TermType[0] != '\0') + fprintf(stderr, ", terminal '%s'", TermType); +diff --git a/ncurses/tinfo/read_entry.c b/ncurses/tinfo/read_entry.c +index 341337d2..b0c3ad26 100644 +--- a/ncurses/tinfo/read_entry.c ++++ b/ncurses/tinfo/read_entry.c +@@ -138,12 +138,13 @@ convert_16bits(char *buf, NCURSES_INT2 *Numbers, int count) + } + #endif + +-static void +-convert_strings(char *buf, char **Strings, int count, int size, char *table) ++static bool ++convert_strings(char *buf, char **Strings, int count, int size, ++ char *table, bool always) + { + int i; + char *p; +- bool corrupt = FALSE; ++ bool success = TRUE; + + for (i = 0; i < count; i++) { + if (IS_NEG1(buf + 2 * i)) { +@@ -159,13 +160,10 @@ convert_strings(char *buf, char **Strings, int count, int size, char *table) + TR(TRACE_DATABASE, ("Strings[%d] = %s", i, + _nc_visbuf(Strings[i]))); + } else { +- if (!corrupt) { +- corrupt = TRUE; +- TR(TRACE_DATABASE, +- ("ignore out-of-range index %d to Strings[]", nn)); +- _nc_warning("corrupt data found in convert_strings"); +- } +- Strings[i] = ABSENT_STRING; ++ TR(TRACE_DATABASE, ++ ("found out-of-range index %d to Strings[%d]", nn, i)); ++ success = FALSE; ++ break; + } + } + +@@ -175,10 +173,25 @@ convert_strings(char *buf, char **Strings, int count, int size, char *table) + if (*p == '\0') + break; + /* if there is no NUL, ignore the string */ +- if (p >= table + size) ++ if (p >= table + size) { + Strings[i] = ABSENT_STRING; ++ } else if (p == Strings[i] && always) { ++ TR(TRACE_DATABASE, ++ ("found empty but required Strings[%d]", i)); ++ success = FALSE; ++ break; ++ } ++ } else if (always) { /* names are always needed */ ++ TR(TRACE_DATABASE, ++ ("found invalid but required Strings[%d]", i)); ++ success = FALSE; ++ break; + } + } ++ if (!success) { ++ _nc_warning("corrupt data found in convert_strings"); ++ } ++ return success; + } + + static int +@@ -382,7 +395,10 @@ _nc_read_termtype(TERMTYPE2 *ptr, char *buffer, int limit) + if (Read(string_table, (unsigned) str_size) != str_size) { + returnDB(TGETENT_NO); + } +- convert_strings(buf, ptr->Strings, str_count, str_size, string_table); ++ if (!convert_strings(buf, ptr->Strings, str_count, str_size, ++ string_table, FALSE)) { ++ returnDB(TGETENT_NO); ++ } + } + #if NCURSES_XNAMES + +@@ -483,8 +499,10 @@ _nc_read_termtype(TERMTYPE2 *ptr, char *buffer, int limit) + ("Before computing extended-string capabilities " + "str_count=%d, ext_str_count=%d", + str_count, ext_str_count)); +- convert_strings(buf, ptr->Strings + str_count, ext_str_count, +- ext_str_limit, ptr->ext_str_table); ++ if (!convert_strings(buf, ptr->Strings + str_count, ext_str_count, ++ ext_str_limit, ptr->ext_str_table, FALSE)) { ++ returnDB(TGETENT_NO); ++ } + for (i = ext_str_count - 1; i >= 0; i--) { + TR(TRACE_DATABASE, ("MOVE from [%d:%d] %s", + i, i + str_count, +@@ -516,10 +534,13 @@ _nc_read_termtype(TERMTYPE2 *ptr, char *buffer, int limit) + TR(TRACE_DATABASE, + ("ext_NAMES starting @%d in extended_strings, first = %s", + base, _nc_visbuf(ptr->ext_str_table + base))); +- convert_strings(buf + (2 * ext_str_count), +- ptr->ext_Names, +- (int) need, +- ext_str_limit, ptr->ext_str_table + base); ++ if (!convert_strings(buf + (2 * ext_str_count), ++ ptr->ext_Names, ++ (int) need, ++ ext_str_limit, ptr->ext_str_table + base, ++ TRUE)) { ++ returnDB(TGETENT_NO); ++ } + } + + TR(TRACE_DATABASE, +@@ -572,13 +593,17 @@ _nc_read_file_entry(const char *const filename, TERMTYPE2 *ptr) + int limit; + char buffer[MAX_ENTRY_SIZE + 1]; + +- if ((limit = (int) fread(buffer, sizeof(char), sizeof(buffer), fp)) +- > 0) { ++ limit = (int) fread(buffer, sizeof(char), sizeof(buffer), fp); ++ if (limit > 0) { ++ const char *old_source = _nc_get_source(); + + TR(TRACE_DATABASE, ("read terminfo %s", filename)); ++ if (old_source == NULL) ++ _nc_set_source(filename); + if ((code = _nc_read_termtype(ptr, buffer, limit)) == TGETENT_NO) { + _nc_free_termtype2(ptr); + } ++ _nc_set_source(old_source); + } else { + code = TGETENT_NO; + } +-- +2.40.0 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..7d90ddd30f --- /dev/null +++ b/meta/recipes-core/ncurses/files/CVE-2023-50495.patch @@ -0,0 +1,301 @@ +From 7daae3f2139a678fe0ae0b42fcf8d807cbff485c Mon Sep 17 00:00:00 2001 +From: Mingli Yu <mingli.yu@windriver.com> +Date: Sun, 4 Feb 2024 13:42:38 +0800 +Subject: [PATCH] parse_entry.c: check return value of _nc_save_str + +* check return value of _nc_save_str(), in special case for tic where +extended capabilities are processed but the terminal description was +not initialized (report by Ziqiao Kong). + +* regenerate llib-* files. + +CVE: CVE-2023-50495 + +Upstream-Status: Backport [http://ncurses.scripts.mit.edu/?p=ncurses.git;a=commitdiff;h=7723dd6799ab10b32047ec73b14df9f107bafe99] + +Signed-off-by: Mingli Yu <mingli.yu@windriver.com> +--- + ncurses/llib-lncurses | 15 +++++++++++++++ + ncurses/llib-lncursest | 15 +++++++++++++++ + ncurses/llib-lncursestw | 15 +++++++++++++++ + ncurses/llib-lncursesw | 15 +++++++++++++++ + ncurses/llib-ltinfo | 15 +++++++++++++++ + ncurses/llib-ltinfot | 15 +++++++++++++++ + ncurses/llib-ltinfotw | 15 +++++++++++++++ + ncurses/llib-ltinfow | 15 +++++++++++++++ + ncurses/tinfo/parse_entry.c | 23 ++++++++++++++++------- + 9 files changed, 136 insertions(+), 7 deletions(-) + +diff --git a/ncurses/llib-lncurses b/ncurses/llib-lncurses +index 211cf3b7..e4190aa2 100644 +--- a/ncurses/llib-lncurses ++++ b/ncurses/llib-lncurses +@@ -3656,6 +3656,21 @@ char *tiparm( + ...) + { return(*(char **)0); } + ++#undef tiparm_s ++char *tiparm_s( ++ int num_expected, ++ int tparm_type, ++ const char *string, ++ ...) ++ { return(*(char **)0); } ++ ++#undef tiscan_s ++int tiscan_s( ++ int *num_expected, ++ int *tparm_type, ++ const char *string) ++ { return(*(int *)0); } ++ + #undef _nc_tiparm + char *_nc_tiparm( + int expected, +diff --git a/ncurses/llib-lncursest b/ncurses/llib-lncursest +index 1b09d676..e07abba6 100644 +--- a/ncurses/llib-lncursest ++++ b/ncurses/llib-lncursest +@@ -3741,6 +3741,21 @@ char *tiparm( + ...) + { return(*(char **)0); } + ++#undef tiparm_s ++char *tiparm_s( ++ int num_expected, ++ int tparm_type, ++ const char *string, ++ ...) ++ { return(*(char **)0); } ++ ++#undef tiscan_s ++int tiscan_s( ++ int *num_expected, ++ int *tparm_type, ++ const char *string) ++ { return(*(int *)0); } ++ + #undef _nc_tiparm + char *_nc_tiparm( + int expected, +diff --git a/ncurses/llib-lncursestw b/ncurses/llib-lncursestw +index 4576e0fc..747c6be8 100644 +--- a/ncurses/llib-lncursestw ++++ b/ncurses/llib-lncursestw +@@ -4702,6 +4702,21 @@ char *tiparm( + ...) + { return(*(char **)0); } + ++#undef tiparm_s ++char *tiparm_s( ++ int num_expected, ++ int tparm_type, ++ const char *string, ++ ...) ++ { return(*(char **)0); } ++ ++#undef tiscan_s ++int tiscan_s( ++ int *num_expected, ++ int *tparm_type, ++ const char *string) ++ { return(*(int *)0); } ++ + #undef _nc_tiparm + char *_nc_tiparm( + int expected, +diff --git a/ncurses/llib-lncursesw b/ncurses/llib-lncursesw +index 127350d2..862305d9 100644 +--- a/ncurses/llib-lncursesw ++++ b/ncurses/llib-lncursesw +@@ -4617,6 +4617,21 @@ char *tiparm( + ...) + { return(*(char **)0); } + ++#undef tiparm_s ++char *tiparm_s( ++ int num_expected, ++ int tparm_type, ++ const char *string, ++ ...) ++ { return(*(char **)0); } ++ ++#undef tiscan_s ++int tiscan_s( ++ int *num_expected, ++ int *tparm_type, ++ const char *string) ++ { return(*(int *)0); } ++ + #undef _nc_tiparm + char *_nc_tiparm( + int expected, +diff --git a/ncurses/llib-ltinfo b/ncurses/llib-ltinfo +index a5cd7cd3..31e5e9a6 100644 +--- a/ncurses/llib-ltinfo ++++ b/ncurses/llib-ltinfo +@@ -927,6 +927,21 @@ char *tiparm( + ...) + { return(*(char **)0); } + ++#undef tiparm_s ++char *tiparm_s( ++ int num_expected, ++ int tparm_type, ++ const char *string, ++ ...) ++ { return(*(char **)0); } ++ ++#undef tiscan_s ++int tiscan_s( ++ int *num_expected, ++ int *tparm_type, ++ const char *string) ++ { return(*(int *)0); } ++ + #undef _nc_tiparm + char *_nc_tiparm( + int expected, +diff --git a/ncurses/llib-ltinfot b/ncurses/llib-ltinfot +index bd3de812..48e5c25a 100644 +--- a/ncurses/llib-ltinfot ++++ b/ncurses/llib-ltinfot +@@ -1003,6 +1003,21 @@ char *tiparm( + ...) + { return(*(char **)0); } + ++#undef tiparm_s ++char *tiparm_s( ++ int num_expected, ++ int tparm_type, ++ const char *string, ++ ...) ++ { return(*(char **)0); } ++ ++#undef tiscan_s ++int tiscan_s( ++ int *num_expected, ++ int *tparm_type, ++ const char *string) ++ { return(*(int *)0); } ++ + #undef _nc_tiparm + char *_nc_tiparm( + int expected, +diff --git a/ncurses/llib-ltinfotw b/ncurses/llib-ltinfotw +index 4d35a1e1..64dfdfa5 100644 +--- a/ncurses/llib-ltinfotw ++++ b/ncurses/llib-ltinfotw +@@ -1025,6 +1025,21 @@ char *tiparm( + ...) + { return(*(char **)0); } + ++#undef tiparm_s ++char *tiparm_s( ++ int num_expected, ++ int tparm_type, ++ const char *string, ++ ...) ++ { return(*(char **)0); } ++ ++#undef tiscan_s ++int tiscan_s( ++ int *num_expected, ++ int *tparm_type, ++ const char *string) ++ { return(*(int *)0); } ++ + #undef _nc_tiparm + char *_nc_tiparm( + int expected, +diff --git a/ncurses/llib-ltinfow b/ncurses/llib-ltinfow +index db846764..7e17a35f 100644 +--- a/ncurses/llib-ltinfow ++++ b/ncurses/llib-ltinfow +@@ -949,6 +949,21 @@ char *tiparm( + ...) + { return(*(char **)0); } + ++#undef tiparm_s ++char *tiparm_s( ++ int num_expected, ++ int tparm_type, ++ const char *string, ++ ...) ++ { return(*(char **)0); } ++ ++#undef tiscan_s ++int tiscan_s( ++ int *num_expected, ++ int *tparm_type, ++ const char *string) ++ { return(*(int *)0); } ++ + #undef _nc_tiparm + char *_nc_tiparm( + int expected, +diff --git a/ncurses/tinfo/parse_entry.c b/ncurses/tinfo/parse_entry.c +index 14bcb67e..0a0b5637 100644 +--- a/ncurses/tinfo/parse_entry.c ++++ b/ncurses/tinfo/parse_entry.c +@@ -110,7 +110,7 @@ _nc_extend_names(ENTRY * entryp, const char *name, int token_type) + /* Well, we are given a cancel for a name that we don't recognize */ + return _nc_extend_names(entryp, name, STRING); + default: +- return 0; ++ return NULL; + } + + /* Adjust the 'offset' (insertion-point) to keep the lists of extended +@@ -142,6 +142,11 @@ _nc_extend_names(ENTRY * entryp, const char *name, int token_type) + for (last = (unsigned) (max - 1); last > tindex; last--) + + if (!found) { ++ char *saved; ++ ++ if ((saved = _nc_save_str(name)) == NULL) ++ return NULL; ++ + switch (token_type) { + case BOOLEAN: + tp->ext_Booleans++; +@@ -169,7 +174,7 @@ _nc_extend_names(ENTRY * entryp, const char *name, int token_type) + TYPE_REALLOC(char *, actual, tp->ext_Names); + while (--actual > offset) + tp->ext_Names[actual] = tp->ext_Names[actual - 1]; +- tp->ext_Names[offset] = _nc_save_str(name); ++ tp->ext_Names[offset] = saved; + } + + temp.nte_name = tp->ext_Names[offset]; +@@ -364,6 +369,8 @@ _nc_parse_entry(ENTRY * entryp, int literal, bool silent) + bool is_use = (strcmp(_nc_curr_token.tk_name, "use") == 0); + bool is_tc = !is_use && (strcmp(_nc_curr_token.tk_name, "tc") == 0); + if (is_use || is_tc) { ++ char *saved; ++ + if (!VALID_STRING(_nc_curr_token.tk_valstring) + || _nc_curr_token.tk_valstring[0] == '\0') { + _nc_warning("missing name for use-clause"); +@@ -377,11 +384,13 @@ _nc_parse_entry(ENTRY * entryp, int literal, bool silent) + _nc_curr_token.tk_valstring); + continue; + } +- entryp->uses[entryp->nuses].name = _nc_save_str(_nc_curr_token.tk_valstring); +- entryp->uses[entryp->nuses].line = _nc_curr_line; +- entryp->nuses++; +- if (entryp->nuses > 1 && is_tc) { +- BAD_TC_USAGE ++ if ((saved = _nc_save_str(_nc_curr_token.tk_valstring)) != NULL) { ++ entryp->uses[entryp->nuses].name = saved; ++ entryp->uses[entryp->nuses].line = _nc_curr_line; ++ entryp->nuses++; ++ if (entryp->nuses > 1 && is_tc) { ++ BAD_TC_USAGE ++ } + } + } else { + /* normal token lookup */ +-- +2.25.1 + diff --git a/meta/recipes-core/ncurses/files/config.cache b/meta/recipes-core/ncurses/files/config.cache deleted file mode 100644 index 6a9217d5bb..0000000000 --- a/meta/recipes-core/ncurses/files/config.cache +++ /dev/null @@ -1,4 +0,0 @@ -#! /bin/sh - -cf_cv_func_nanosleep=yes -cf_cv_func_mkstemp=yes diff --git a/meta/recipes-core/ncurses/files/exit_prototype.patch b/meta/recipes-core/ncurses/files/exit_prototype.patch new file mode 100644 index 0000000000..fd961512e0 --- /dev/null +++ b/meta/recipes-core/ncurses/files/exit_prototype.patch @@ -0,0 +1,32 @@ +From 4a769a441d7e57a23017c3037cde3e53fb9f35fe Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Tue, 30 Aug 2022 15:58:32 -0700 +Subject: [PATCH] Add needed headers for including mbstate_t and exit() + +Upstream-Status: Inappropriate [Reconfigure will solve it] +Signed-off-by: Khem Raj <raj.khem@gmail.com> + +--- + configure | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/configure b/configure +index f377f551..163f8899 100755 +--- a/configure ++++ b/configure +@@ -3423,6 +3423,7 @@ rm -f "conftest.$ac_objext" "conftest.$ac_ext" + cat >"conftest.$ac_ext" <<_ACEOF + #line 3424 "configure" + #include "confdefs.h" ++#include <stdlib.h> + $ac_declaration + int + main (void) +@@ -13111,6 +13112,7 @@ cat >"conftest.$ac_ext" <<_ACEOF + #include <stdlib.h> + #include <stdarg.h> + #include <stdio.h> ++#include <wchar.h> + #ifdef HAVE_LIBUTF8_H + #include <libutf8.h> + #endif |