mirror of
https://github.com/openbsd/xenocara.git
synced 2025-12-14 21:29:14 +00:00
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.
This commit is contained in:
@@ -603,7 +603,7 @@ XkbStringText(char *str, unsigned format)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*out++ = '0';
|
*out++ = '0';
|
||||||
sprintf(out, "%o", *in);
|
sprintf(out, "%o", (unsigned char) *in);
|
||||||
while (*out != '\0')
|
while (*out != '\0')
|
||||||
out++;
|
out++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user