summaryrefslogtreecommitdiff
path: root/src/conf.c
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@googlemail.com>2012-07-21 20:12:00 +0200
committerDavid Herrmann <dh.herrmann@googlemail.com>2012-07-21 20:12:00 +0200
commit52fa0f80d9b65c7e8d3f2b377fe89ba8e828503b (patch)
tree5feee3096dd9432005450b877a76377482ba67d6 /src/conf.c
parent741b8d33dfb3a9e5bb3b322db5f5e06d360a8024 (diff)
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>
Diffstat (limited to 'src/conf.c')
-rw-r--r--src/conf.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/conf.c b/src/conf.c
index aae439e..8ff2892 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -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;