From: simon Date: Sun, 22 Apr 2012 14:22:08 +0000 (+0000) Subject: Bug fix from Robert de Bath: if wc_to_mb returns a length of zero, it X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/commitdiff_plain/8a0c25526881df05f81c34264c4e37b0caff3d7e Bug fix from Robert de Bath: if wc_to_mb returns a length of zero, it will not even initialise sbstring[0], so we shouldn't even look at it let alone depend on it to tell us the desired character was absent. git-svn-id: svn://svn.tartarus.org/sgt/putty@9465 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/unix/gtkfont.c b/unix/gtkfont.c index 1aa1df85..123731a1 100644 --- a/unix/gtkfont.c +++ b/unix/gtkfont.c @@ -430,7 +430,7 @@ static int x11font_has_glyph(unifont *font, wchar_t glyph) char sbstring[2]; int sblen = wc_to_mb(xfont->real_charset, 0, &glyph, 1, sbstring, 2, "", NULL, NULL); - if (!sbstring[0]) + if (sblen == 0 || !sbstring[0]) return FALSE; /* not even in the charset */ return x11_font_has_glyph(xfont->fonts[0], 0,