conf: fix invalid memory access in strip_spaces()
We must not assume that the string is longer than 0 characters. Therefore, check whether we would access invalid memory before the string when removing trailing whitespaces. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
1 parent
741b8d33df
commit
52fa0f80d9
1 file changed
+3
@@ -385,6 +385,9 @@ static void strip_spaces(char **buf)
|
||||
while (**buf == ' ' || **buf == '\r' || **buf == '\t')
|
||||
++*buf;
|
||||
|
||||
if (!**buf)
|
||||
return;
|
||||
|
||||
tail = *buf;
|
||||
while (*tail)
|
||||
++tail;
|
||||
|
||||
Reference in new issue
Block a user