5
0
mirror of git://git.proxmox.com/git/spiceterm.git synced 2024-12-22 13:34:06 +03:00

check range for utf8 characters

since we load the font from psf1 files, the highest utf8 codepoint we
have a fontmap for is 0xFFFF, so we use an unsigned short for the
character

but since we parse utf8 for up to 6 bytes we have to check the range, or
else we can get garbled output

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2017-02-28 12:06:38 +01:00 committed by Dietmar Maurer
parent 8cda4721fb
commit 6d378df57f

View File

@ -1232,7 +1232,11 @@ spiceterm_puts(spiceTerm *vt, const char *buf, int len)
vt->utf_char = (vt->utf_char << 6) | (c & 0x3f);
vt->utf_count--;
if (vt->utf_count == 0) {
tc = vt->utf_char;
if (vt->utf_char <= G_MAXUINT16) {
tc = vt->utf_char;
} else {
tc = 0;
}
} else {
continue;
}