fake_outputs: Don't read past the end of string

fake_outputs_init would unconditionally increase the string read
pointer variable (walk) by one character more than the number of
characters that have been read, to skip past the character delimiting
records (a comma). However, when the input string was not terminated
by a comma, it would cause the function to read past the null
terminator instead.

Avoid this by explicitly checking for the expected delimiter.
This commit is contained in:
Vladimir Panteleev 2017-09-19 14:37:35 +00:00
parent 755b223278
commit 19b00346e5
No known key found for this signature in database
GPG Key ID: 5004F0FAD051576D
1 changed files with 3 additions and 1 deletions

View File

@ -68,7 +68,9 @@ void fake_outputs_init(const char *output_spec) {
num_screens++;
}
walk += chars_consumed + 1;
walk += chars_consumed;
if (*walk == ',')
walk++;
}
if (num_screens == 0) {