mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-01-06 17:50:12 +01:00
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>
This commit is contained in:
parent
9de3cc8daa
commit
daa1a9d22d
1 changed files with 1 additions and 1 deletions
2
os/log.c
2
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue