diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2017-10-14 09:12:45 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2017-10-14 09:12:45 +0000 |
commit | 0f237ba219709e917868de0408b8084077e49b31 (patch) | |
tree | 007fca66299352a90c54765a3e9d1e6bb6148d51 | |
parent | 81452c63062e54ed90fb20f8f9ba5bbd4e6c35fd (diff) |
MFC: xkb: Escape non-printable characters correctly
XkbStringText escapes non-printable characters using octal numbers.
Such escape sequence would be at most 5 characters long ("\0123"), so
it reserves 5 bytes in the buffer. Due to char->unsigned int
conversion, it would print much longer string for negative numbers.
-rw-r--r-- | xserver/xkb/xkbtext.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/xserver/xkb/xkbtext.c b/xserver/xkb/xkbtext.c index 419b4cc76..7b6729bd3 100644 --- a/xserver/xkb/xkbtext.c +++ b/xserver/xkb/xkbtext.c @@ -603,7 +603,7 @@ XkbStringText(char *str, unsigned format) } else { *out++ = '0'; - sprintf(out, "%o", *in); + sprintf(out, "%o", (unsigned char) *in); while (*out != '\0') out++; } |