Fix illegal access

This commit is contained in:
Arun Prakash Jana 2020-08-02 17:03:35 +05:30
parent 83fa6a0ff6
commit d5e303beb7
No known key found for this signature in database
GPG Key ID: A75979F35C080412
1 changed files with 7 additions and 4 deletions

View File

@ -1594,6 +1594,8 @@ static bool initcurses(void *oldmask)
use_default_colors(); use_default_colors();
if (colors && *colors == '#') { if (colors && *colors == '#') {
char *sep = strchr(colors, ';');
if (COLORS >= 256) { if (COLORS >= 256) {
++colors; ++colors;
ext = TRUE; ext = TRUE;
@ -1603,12 +1605,13 @@ static bool initcurses(void *oldmask)
* to NULL so we don't interpret separator and fallback * to NULL so we don't interpret separator and fallback
* if fewer than CTX_MAX xterm 256 colors are specified. * if fewer than CTX_MAX xterm 256 colors are specified.
*/ */
char *sep = strchr(colors, ';');
if (sep) if (sep)
*sep = '\0'; *sep = '\0';
} else } else {
/* Check if 8 colors fallback is appended */ colors = sep; /* Detect if 8 colors fallback is appended */
colors = strchr(colors, ';') + 1; if (colors)
++colors;
}
} }
/* Get and set the context colors */ /* Get and set the context colors */