summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2014-07-07 08:27:44 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2014-07-10 10:24:04 +1000
commitdaa1a9d22db8e83d1933d8403acf72626199ee2a (patch)
tree2d552284467abb31fccaad3d2610995499ccc7d0
parent9de3cc8daa4c6e877d30a0e8ccfe0cc159f1dbe3 (diff)
os: prevent negative array index access (#80890)
If an empty string is provided to LogMessageVerbSigSafe, the length of the printed string is 0. Read-only access only and the only effect it had was adding a linebreak or not. X.Org Bug 80890 <http://bugs.freedesktop.org/show_bug.cgi?id=80890> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--os/log.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/os/log.c b/os/log.c
index a368569d0..2a721b948 100644
--- a/os/log.c
+++ b/os/log.c
@@ -697,7 +697,7 @@ LogVMessageVerbSigSafe(MessageType type, int verb, const char *format, va_list a
if (sizeof(buf) - len == 1)
buf[len - 1] = '\n';
- newline = (buf[len - 1] == '\n');
+ newline = (len > 0 && buf[len - 1] == '\n');
LogSWrite(verb, buf, len, newline);
}