diff options
author | David Herrmann <dh.herrmann@googlemail.com> | 2012-07-21 20:12:00 +0200 |
---|---|---|
committer | David Herrmann <dh.herrmann@googlemail.com> | 2012-07-21 20:12:00 +0200 |
commit | 52fa0f80d9b65c7e8d3f2b377fe89ba8e828503b (patch) | |
tree | 5feee3096dd9432005450b877a76377482ba67d6 /src/conf.c | |
parent | 741b8d33dfb3a9e5bb3b322db5f5e06d360a8024 (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.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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; |