Complete Yocto mirror with license table for TQMa6UL (2038-compliance)

- 264 license table entries with exact download URLs (224/264 resolved)
- Complete sources/ directory with all BitBake recipes
- Build configuration: tqma6ul-multi-mba6ulx, spaetzle (musl)
- Full traceability for Softwarefreigabeantrag
- GCC 13.4.0, Linux 6.6.102, U-Boot 2023.04, musl 1.2.4
- License distribution: GPL-2.0 (24), MIT (23), GPL-2.0+ (18), BSD-3 (16)
This commit is contained in:
Siggi (OpenClaw Agent)
2026-03-01 20:58:18 +00:00
commit 16accb6b24
15086 changed files with 1292356 additions and 0 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,43 @@
From 168ba7a681be73ac024438e33e14fde1d5aea97d Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Fri, 30 Mar 2018 10:02:24 +0800
Subject: [PATCH 1/2] tic hang
Upstream-Status: Inappropriate [configuration]
'tic' of some linux distributions (e.g. fedora 11) hang in an infinite
loop when processing the original file.
Signed-off-by: anonymous
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 84f4810..6b385ec 100644
--- a/misc/terminfo.src
+++ b/misc/terminfo.src
@@ -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+pcfkeys|konsole subset of xterm+pcfkeys,
- 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
--
1.8.3.1

View File

@@ -0,0 +1,33 @@
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] configure: reproducible
"configure" enforces -U for ar flags, breaking deterministic builds.
The flag was added to fix some vaguely specified "recent POSIX binutil
build problems" in 2015.
Upstream-Status: Pending
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
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 421cf859..a1b7840d 100755
--- a/configure
+++ b/configure
@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,25 @@
From 27d1493340d714e7be6e08c0a8f43e48276149c4 Mon Sep 17 00:00:00 2001
From: "Thomas E. Dickey" <dickey@invisible-island.net>
Date: Sat, 29 Mar 2025 22:52:37 +0000
Subject: [PATCH] snapshot of project "ncurses", label v6_5_20250329
CVE: CVE-2025-6141
Upstream-Status: Backport [https://github.com/ThomasDickey/ncurses-snapshots/commit/27d1493340d714e7be6e08c0a8f43e48276149c4]
Signed-off-by: Peter Marko <peter.marko@siemens.com>
---
ncurses/tinfo/parse_entry.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/ncurses/tinfo/parse_entry.c b/ncurses/tinfo/parse_entry.c
index a2278c07..c551c780 100644
--- a/ncurses/tinfo/parse_entry.c
+++ b/ncurses/tinfo/parse_entry.c
@@ -985,6 +985,8 @@ postprocess_termcap(TERMTYPE2 *tp, bool has_base)
bp = tp->Strings[from_ptr->nte_index];
if (VALID_STRING(bp)) {
for (dp = buf2; *bp; bp++) {
+ if ((size_t) (dp - buf2) >= (sizeof(buf2) - sizeof(TERMTYPE2)))
+ break;
if (bp[0] == '$' && bp[1] == '<') {
while (*bp && *bp != '>') {
++bp;

View File

@@ -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

View File

@@ -0,0 +1,325 @@
SUMMARY = "The New Curses library"
DESCRIPTION = "SVr4 and XSI-Curses compatible curses library and terminfo tools including tic, infocmp, captoinfo. Supports color, multiple highlights, forms-drawing characters, and automatic recognition of keypad and function-key sequences. Extensions include resizable windows and mouse support on both xterm and Linux console using the gpm library."
HOMEPAGE = "http://www.gnu.org/software/ncurses/ncurses.html"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://COPYING;md5=c5a4600fdef86384c41ca33ecc70a4b8;endline=27"
SECTION = "libs"
DEPENDS = "ncurses-native"
DEPENDS:class-native = ""
BINCONFIG = "${bindir}/ncurses5-config ${bindir}/ncursesw5-config \
${bindir}/ncurses6-config ${bindir}/ncursesw6-config"
inherit autotools binconfig-disabled multilib_header pkgconfig
# Upstream has useful patches at times at ftp://invisible-island.net/ncurses/
SRC_URI = "git://github.com/ThomasDickey/ncurses-snapshots.git;protocol=https;branch=master"
EXTRA_AUTORECONF = "-I m4"
CACHED_CONFIGUREVARS = "cf_cv_func_nanosleep=yes"
CACHED_CONFIGUREVARS:append:linux = " cf_cv_working_poll=yes"
EXTRASITECONFIG = "CFLAGS='${CFLAGS} -I${SYSROOT_DESTDIR}${includedir}'"
# Whether to enable separate widec libraries; must be 'true' or 'false'
#
# TODO: remove this variable when widec is supported in every setup?
ENABLE_WIDEC ?= "true"
# _GNU_SOURCE is required for widec stuff and is not detected automatically
CPPFLAGS += "-D_GNU_SOURCE"
# natives don't generally look in base_libdir
base_libdir:class-native = "${libdir}"
# Display corruption occurs on 64 bit hosts without these settings
# This was derrived from the upstream debian ncurses which uses
# these settings for 32 and 64 bit hosts.
EXCONFIG_ARGS = ""
EXCONFIG_ARGS:class-native = " \
--disable-lp64 \
--with-chtype='long' \
--with-mmask-t='long'"
EXCONFIG_ARGS:class-nativesdk = " \
--disable-lp64 \
--with-chtype='long' \
--with-mmask-t='long'"
PACKAGES_DYNAMIC = "^${PN}-lib.*"
# Fall back to the host termcap / terminfo for -nativesdk and -native
# The reality is a work around for strange problems with things like
# "bitbake -c menuconfig busybox" where it cannot find the terminfo
# because the sstate had a hard coded search path. Until this is fixed
# another way this is deemed good enough.
EX_TERMCAP = ""
EX_TERMCAP:class-native = ":/etc/termcap:/usr/share/misc/termcap"
EX_TERMCAP:class-nativesdk = ":/etc/termcap:/usr/share/misc/termcap"
EX_TERMINFO = ""
EX_TERMINFO:class-native = ":/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo"
EX_TERMINFO:class-nativesdk = ":/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo"
EX_TERMLIB ?= "tinfo"
# Helper function for do_configure to allow multiple configurations
# $1 the directory to run configure in
# $@ the arguments to pass to configure
ncurses_configure() {
mkdir -p $1
cd $1
shift
oe_runconf \
--without-debug \
--without-ada \
--without-gpm \
--enable-hard-tabs \
--enable-xmc-glitch \
--enable-colorfgbg \
--with-termpath='${sysconfdir}/termcap:${datadir}/misc/termcap${EX_TERMCAP}' \
--with-terminfo-dirs='${sysconfdir}/terminfo:${datadir}/terminfo${EX_TERMINFO}' \
--with-shared \
--disable-big-core \
--program-prefix= \
--with-ticlib \
--with-termlib=${EX_TERMLIB} \
--enable-sigwinch \
--enable-pc-files \
--disable-rpath-hack \
${EXCONFIG_ARGS} \
--with-manpage-format=normal \
--without-manpage-renames \
--disable-stripping \
"$@" || return 1
cd ..
}
# Override the function from the autotools class; ncurses requires a
# patched autoconf213 to generate the configure script. This autoconf
# is not available so that the shipped script will be used.
do_configure() {
#Remove ${includedir} from CPPFLAGS, need for cross compile
sed -i 's#-I${cf_includedir}##g' ${S}/configure || die "sed CPPFLAGS"
# The --enable-pc-files requires PKG_CONFIG_LIBDIR existed
mkdir -p ${PKG_CONFIG_LIBDIR}
( cd ${S}; gnu-configize --force )
ncurses_configure "narrowc" || \
return 1
! ${ENABLE_WIDEC} || \
ncurses_configure "widec" "--enable-widec" "--without-progs"
}
do_compile() {
oe_runmake -C narrowc libs
oe_runmake -C narrowc/progs
! ${ENABLE_WIDEC} || \
oe_runmake -C widec libs
}
# set of expected differences between narrowc and widec header
#
# TODO: the NCURSES_CH_T difference can cause real problems :(
_unifdef_cleanup = " \
-e '\!/\* \$Id: curses.wide,v!,\!/\* \$Id: curses.tail,v!d' \
-e '/^#define NCURSES_CH_T /d' \
-e '/^#include <wchar.h>/d' \
-e '\!^/\* .* \*/!d' \
"
do_test[depends] = "unifdef-native:do_populate_sysroot"
do_test[dirs] = "${S}"
do_test() {
${ENABLE_WIDEC} || return 0
# make sure that the narrow and widec header are compatible
# and differ only in minor details.
unifdef -k narrowc/include/curses.h | \
sed ${_unifdef_cleanup} > curses-narrowc.h
unifdef -k widec/include/curses.h | \
sed ${_unifdef_cleanup} > curses-widec.h
diff curses-narrowc.h curses-widec.h
}
# Split original _install_opts to two parts.
# One is the options to install contents, the other is the parameters \
# when running command "make install"
# Note that install.libs will also implicitly install header files,
# so we do not need to explicitly specify install.includes.
# Doing so could in fact result in a race condition, as both targets
# (install.libs and install.includes) would install the same headers
# at the same time
_install_opts = " install.libs install.man "
_install_cfgs = "\
DESTDIR='${D}' \
PKG_CONFIG_LIBDIR='${libdir}/pkgconfig' \
"
do_install() {
# Order of installation is important; widec installs a 'curses.h'
# header with more definitions and must be installed last hence.
# Compatibility of these headers will be checked in 'do_test()'.
oe_runmake -C narrowc ${_install_cfgs} ${_install_opts} \
install.progs
# The install.data should run after install.libs, otherwise
# there would be a race issue in a very critical conditon, since
# tic will be run by install.data, and tic needs libtinfo.so
# which would be regenerated by install.libs.
oe_runmake -C narrowc ${_install_cfgs} \
install.data
! ${ENABLE_WIDEC} || \
oe_runmake -C widec ${_install_cfgs} ${_install_opts}
cd narrowc
# include some basic terminfo files
# stolen ;) from gentoo and modified a bit
for x in ansi console dumb linux rxvt screen screen-256color sun vt52 vt100 vt102 vt200 vt220 xterm-color xterm-xfree86 xterm-256color
do
local termfile="$(find "${D}${datadir}/terminfo/" -name "${x}" 2>/dev/null)"
local basedir="$(basename $(dirname "${termfile}"))"
if [ -n "${termfile}" ]
then
install -d ${D}${sysconfdir}/terminfo/${basedir}
mv ${termfile} ${D}${sysconfdir}/terminfo/${basedir}/
ln -s /etc/terminfo/${basedir}/${x} \
${D}${datadir}/terminfo/${basedir}/${x}
fi
done
# i think we can use xterm-color as default xterm
if [ -e ${D}${sysconfdir}/terminfo/x/xterm-color ]
then
ln -sf xterm-color ${D}${sysconfdir}/terminfo/x/xterm
fi
# When changing ${libdir} to e.g. /usr/lib/myawesomelib/ ncurses
# still installs '/usr/lib/terminfo', so try to rm both
# the proper path and a slightly hardcoded one
rm -f ${D}${libdir}/terminfo ${D}${prefix}/lib/terminfo
# create linker scripts for libcurses.so and libncurses to
# link against -ltinfo when needed. Some builds might break
# else when '-Wl,--no-copy-dt-needed-entries' has been set in
# linker flags.
for i in libncurses libncursesw; do
f=${D}${libdir}/$i.so
test -h $f || continue
rm -f $f
echo '/* GNU ld script */' >$f
echo "INPUT($i.so.5 AS_NEEDED(-ltinfo))" >>$f
done
# Make sure that libcurses is linked so that it gets -ltinfo
# also, this should be addressed upstream really.
ln -sf libncurses.so ${D}${libdir}/libcurses.so
# create libtermcap.so linker script for backward compatibility
f=${D}${libdir}/libtermcap.so
echo '/* GNU ld script */' >$f
echo 'INPUT(AS_NEEDED(-ltinfo))' >>$f
if [ ! -d "${D}${base_libdir}" ]; then
# Setting base_libdir to libdir as is done in the -native
# case will skip this code
mkdir -p ${D}${base_libdir}
mv ${D}${libdir}/libncurses.so.* ${D}${base_libdir}
! ${ENABLE_WIDEC} || \
mv ${D}${libdir}/libncursesw.so.* ${D}${base_libdir}
mv ${D}${libdir}/libtinfo.so.* ${D}${base_libdir}
rm ${D}${libdir}/libtinfo.so
# Use ln -rs to ensure this is a relative link despite absolute paths
# (as we can't know the relationship between base_libdir and libdir).
ln -rs ${D}${base_libdir}/libtinfo.so.5 ${D}${libdir}/libtinfo.so
fi
if [ -d "${D}${includedir}/ncurses" ]; then
for f in `find ${D}${includedir}/ncurses -name "*.h"`
do
f=`basename $f`
test -e ${D}${includedir}/$f && continue
ln -sf ncurses/$f ${D}${includedir}/$f
done
fi
oe_multilib_header curses.h
}
python populate_packages:prepend () {
libdir = d.expand("${libdir}")
base_libdir = d.expand("${base_libdir}")
pnbase = d.expand("${PN}-lib%s")
do_split_packages(d, libdir, r'^lib(.*)\.so\..*', pnbase, 'ncurses %s library', prepend=True, extra_depends = '', allow_links=True)
if libdir is not base_libdir:
do_split_packages(d, base_libdir, r'^lib(.*)\.so\..*', pnbase, 'ncurses %s library', prepend=True, extra_depends = '', allow_links=True)
}
inherit update-alternatives
ALTERNATIVE_PRIORITY = "100"
ALTERNATIVE:ncurses-tools:class-target = "clear reset"
ALTERNATIVE:ncurses-terminfo:class-target = "st st-256color"
ALTERNATIVE_LINK_NAME[st] = "${datadir}/terminfo/s/st"
ALTERNATIVE_LINK_NAME[st-256color] = "${datadir}/terminfo/s/st-256color"
BBCLASSEXTEND = "native nativesdk"
PACKAGES += " \
${PN}-tools \
${PN}-terminfo-base \
${PN}-terminfo \
"
FILES:${PN} = "\
${bindir}/tput \
${bindir}/tset \
${bindir}/ncurses5-config \
${bindir}/ncursesw5-config \
${bindir}/ncurses6-config \
${bindir}/ncursesw6-config \
${datadir}/tabset \
"
# This keeps only tput/tset in ncurses
# clear/reset are in already busybox
FILES:${PN}-tools = "\
${bindir}/tic \
${bindir}/toe \
${bindir}/infotocap \
${bindir}/captoinfo \
${bindir}/infocmp \
${bindir}/clear${@['', '.${BPN}']['${CLASSOVERRIDE}' == 'class-target']} \
${bindir}/reset${@['', '.${BPN}']['${CLASSOVERRIDE}' == 'class-target']} \
${bindir}/tack \
${bindir}/tabs \
"
# 'reset' is a symlink to 'tset' which is in the 'ncurses' package
RDEPENDS:${PN}-tools = "${PN} ${PN}-terminfo-base"
FILES:${PN}-terminfo = "\
${datadir}/terminfo \
"
FILES:${PN}-terminfo-base = "\
${sysconfdir}/terminfo \
"
RSUGGESTS:${PN}-libtinfo = "${PN}-terminfo"
RRECOMMENDS:${PN}-libtinfo = "${PN}-terminfo-base"
# Putting terminfo into the sysroot adds around 2800 files to
# each recipe specific sysroot. We can live without this, particularly
# as many recipes may have native and target copies.
SYSROOT_DIRS:remove = "${datadir}"

View File

@@ -0,0 +1,20 @@
require ncurses.inc
SRC_URI += "file://0001-tic-hang.patch \
file://0002-configure-reproducible.patch \
file://0003-gen-pkgconfig.in-Do-not-include-LDFLAGS-in-generated.patch \
file://exit_prototype.patch \
file://0001-Fix-CVE-2023-29491.patch \
file://0001-Updating-reset-code-ncurses-6.4-patch-20231104.patch \
file://CVE-2023-50495.patch \
file://CVE-2023-45918.patch \
file://CVE-2025-6141.patch \
"
# commit id corresponds to the revision in package version
SRCREV = "1003914e200fd622a27237abca155ce6bf2e6030"
S = "${WORKDIR}/git"
EXTRA_OECONF += "--with-abi-version=5"
UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+_\d+)$"
# This is needed when using patchlevel versions like 6.1+20181013
#CVE_VERSION = "${@d.getVar("PV").split('+')[0]}.${@d.getVar("PV").split('+')[1]}"

View File

@@ -0,0 +1,5 @@
curses.h
ncurses/curses.h
ncurses.h
ncurses/termcap.h