diff options
author | Arun Prakash Jana <engineerarun@gmail.com> | 2020-08-02 17:03:35 +0530 |
---|---|---|
committer | Arun Prakash Jana <engineerarun@gmail.com> | 2020-08-02 17:03:35 +0530 |
commit | d5e303beb77c39118e641b52d5460625096c3f54 (patch) | |
tree | 2274ca251357133ff1b3f24782604578ad101f5c /src | |
parent | 83fa6a0ff62289c9f420a435d4457042f7c420c6 (diff) | |
download | nnn-d5e303beb77c39118e641b52d5460625096c3f54.tar.gz |
Fix illegal access
Diffstat (limited to 'src')
-rw-r--r-- | src/nnn.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -1594,6 +1594,8 @@ static bool initcurses(void *oldmask) use_default_colors(); if (colors && *colors == '#') { + char *sep = strchr(colors, ';'); + if (COLORS >= 256) { ++colors; ext = TRUE; @@ -1603,12 +1605,13 @@ static bool initcurses(void *oldmask) * to NULL so we don't interpret separator and fallback * if fewer than CTX_MAX xterm 256 colors are specified. */ - char *sep = strchr(colors, ';'); if (sep) *sep = '\0'; - } else - /* Check if 8 colors fallback is appended */ - colors = strchr(colors, ';') + 1; + } else { + colors = sep; /* Detect if 8 colors fallback is appended */ + if (colors) + ++colors; + } } /* Get and set the context colors */ |