# HG changeset patch # User Kenichi Handa # Date 1210812086 0 # Node ID e01e37b8203efc4e5bf29cb240a707047a12ee62 # Parent 51e9d65c90fcd71b3cf90036e38d662cd37f1702 (Fnew_fontset): Call font_unparse_xlfd with 256-byte buffer. Check the return value of it. diff -r 51e9d65c90fc -r e01e37b8203e src/fontset.c --- a/src/fontset.c Thu May 15 00:26:27 2008 +0000 +++ b/src/fontset.c Thu May 15 00:41:26 2008 +0000 @@ -1557,7 +1557,7 @@ { Lisp_Object font_spec = Ffont_spec (0, NULL); Lisp_Object short_name; - char *xlfd; + char xlfd[256]; int len; if (font_parse_xlfd (SDATA (name), font_spec) < 0) @@ -1570,8 +1570,9 @@ Vfontset_alias_alist); ASET (font_spec, FONT_REGISTRY_INDEX, Qiso8859_1); fontset = make_fontset (Qnil, name, Qnil); - xlfd = alloca (SBYTES (name) + 1); - len = font_unparse_xlfd (font_spec, 0, xlfd, SBYTES (name) + 1); + len = font_unparse_xlfd (font_spec, 0, xlfd, 256); + if (len < 0) + error ("Invalid fontset name (perhaps too long): %s", SDATA (name)); FONTSET_ASCII (fontset) = make_unibyte_string (xlfd, len); } else