projects
/
platform
/
upstream
/
kmscon.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
741b8d3
)
conf: fix invalid memory access in strip_spaces()
author
David Herrmann
<dh.herrmann@googlemail.com>
Sat, 21 Jul 2012 18:12:00 +0000
(20:12 +0200)
committer
David Herrmann
<dh.herrmann@googlemail.com>
Sat, 21 Jul 2012 18:12:00 +0000
(20:12 +0200)
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>
src/conf.c
patch
|
blob
|
history
diff --git
a/src/conf.c
b/src/conf.c
index
aae439e
..
8ff2892
100644
(file)
--- 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;