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:
David Herrmann committed 2012-07-21 20:12:00 +02:00
1 parent 741b8d33df
commit 52fa0f80d9
1 file changed
+3
+3
View File
@@ -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;