Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:Update
ncurses.32650
ncurses-5.9-bsc1220061.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File ncurses-5.9-bsc1220061.patch of Package ncurses.32650
--- ncurses/tinfo/read_entry.c | 64 +++++++++++++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 22 deletions(-) --- ncurses/tinfo/read_entry.c +++ ncurses/tinfo/read_entry.c 2024-02-19 12:11:15.879198546 +0000 @@ -61,12 +61,13 @@ convert_shorts(char *buf, short *Numbers } } -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)) { @@ -78,30 +79,42 @@ convert_strings(char *buf, char **String } else { int nn = LOW_MSB(buf + 2 * i); if (nn >= 0 && nn < size) { - Strings[i] = (nn + table); + Strings[i] = (nn + 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; - } + } else { + TR(TRACE_DATABASE, + ("found out-of-range index %d to Strings[%d]", nn, i)); + success = FALSE; + break; + } } /* make sure all strings are NUL terminated */ if (VALID_STRING(Strings[i])) { - for (p = Strings[i]; p <= table + size; p++) + for (p = Strings[i]; p < table + size; p++) 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 @@ -259,7 +272,9 @@ _nc_read_termtype(TERMTYPE *ptr, char *b /* finally, grab the string table itself */ if (Read(string_table, (unsigned) str_size) != str_size) return (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)) + return (TGETENT_NO); } #if NCURSES_XNAMES @@ -344,8 +359,10 @@ _nc_read_termtype(TERMTYPE *ptr, char *b TR(TRACE_DATABASE, ("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)) { + return (TGETENT_NO); + } for (i = ext_str_count - 1; i >= 0; i--) { TR(TRACE_DATABASE, ("MOVE from [%d:%d] %s", i, i + str_count, @@ -367,10 +384,13 @@ _nc_read_termtype(TERMTYPE *ptr, char *b 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)) { + return (TGETENT_NO); + } } TR(TRACE_DATABASE,
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor