summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Srb <msrb@suse.com>2017-07-27 11:54:26 +0200
committerJulien Cristau <jcristau@debian.org>2017-10-04 21:06:17 +0200
commiteaf1f72ed8994b708d94ec2de7b1a99f5c4a39b8 (patch)
tree73245476e1d7baa3f0a054e39f081c864b2df90b
parentb95f25af141d33a65f6f821ea9c003f66a01e1f1 (diff)
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. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Julien Cristau <jcristau@debian.org>
-rw-r--r--xkb/xkbtext.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c
index ffbc546b3..ead2b1aee 100644
--- a/xkb/xkbtext.c
+++ b/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++;
}