Fix crash in 256-color setup parsing

Applications can control the 256-color mode and change the palette. This
was not much used until now, but our terminal is now advertising itself
as xterm-256color. Mutt noticed this, tried to use the escape sequence,
and crashed Terminal here.
This commit is contained in:
Adrien Destugues
2017-09-23 16:46:37 +02:00
parent 1a472d01fd
commit 7cb920e579
+2 -2
View File
@@ -1518,7 +1518,7 @@ TermParse::_ProcessOperatingSystemControls(uchar* params)
// colors can be in "idx1:name1;...;idxN:nameN;" sequence too!
uint32 count = 0;
char* p = strtok((char*)params, ";");
do {
while (p != NULL && count < kTermColorCount) {
indexes[count] = atoi(p);
if (!reset) {
@@ -1532,7 +1532,7 @@ TermParse::_ProcessOperatingSystemControls(uchar* params)
count++;
p = strtok(NULL, ";");
} while (p != NULL && count < kTermColorCount);
};
if (count > 0) {
if (!reset)