Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15
ncurses.35592
ncurses-bnc1198627.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File ncurses-bnc1198627.patch of Package ncurses.35592
--- ncurses/tinfo/alloc_entry.c | 12 +++++------- ncurses/tinfo/read_entry.c | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 9 deletions(-) --- ncurses/tinfo/alloc_entry.c +++ ncurses/tinfo/alloc_entry.c 2022-07-15 10:54:20.340284549 +0000 @@ -52,8 +52,6 @@ MODULE_ID("$Id: alloc_entry.c,v 1.61 201 #define ABSENT_OFFSET -1 #define CANCELLED_OFFSET -2 -#define MAX_STRTAB 4096 /* documented maximum entry size */ - static char *stringbuf; /* buffer for string capabilities */ static size_t next_free; /* next free character in stringbuf */ @@ -70,8 +68,8 @@ _nc_init_entry(ENTRY * const tp) } #endif - if (stringbuf == 0) - TYPE_MALLOC(char, (size_t) MAX_STRTAB, stringbuf); + if (stringbuf == NULL) + TYPE_MALLOC(char, (size_t) MAX_ENTRY_SIZE, stringbuf); next_free = 0; @@ -107,11 +105,11 @@ _nc_save_str(const char *const string) * Cheat a little by making an empty string point to the end of the * previous string. */ - if (next_free < MAX_STRTAB) { + if (next_free < MAX_ENTRY_SIZE) { result = (stringbuf + next_free - 1); } - } else if (next_free + len < MAX_STRTAB) { - _nc_STRCPY(&stringbuf[next_free], string, MAX_STRTAB); + } else if (next_free + len < MAX_ENTRY_SIZE) { + _nc_STRCPY(&stringbuf[next_free], string, MAX_ENTRY_SIZE); DEBUG(7, ("Saved string %s", _nc_visbuf(string))); DEBUG(7, ("at location %d", (int) next_free)); next_free += len; --- ncurses/tinfo/read_entry.c +++ ncurses/tinfo/read_entry.c 2022-04-16 21:00:00.000000000 +0000 @@ -144,6 +144,7 @@ convert_strings(char *buf, char **String { int i; char *p; + bool corrupt = FALSE; for (i = 0; i < count; i++) { if (IS_NEG1(buf + 2 * i)) { @@ -153,8 +154,20 @@ convert_strings(char *buf, char **String } else if (MyNumber(buf + 2 * i) > size) { Strings[i] = ABSENT_STRING; } else { - Strings[i] = (MyNumber(buf + 2 * i) + table); - TR(TRACE_DATABASE, ("Strings[%d] = %s", i, _nc_visbuf(Strings[i]))); + int nn = MyNumber(buf + 2 * i); + if (nn >= 0 && nn < size) { + 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; + } } /* make sure all strings are NUL terminated */
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