From 5f2d79e0539460080b61c752fc943fee880e3367 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Thu, 15 May 2008 00:42:32 +0000 Subject: [PATCH] (Fnew_fontset): Call font_unparse_xlfd with 256-byte buffer. Check the return value of it. --- src/ChangeLog | 5 +++++ src/fontset.c | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index b365794448e..a47d774c6a5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2008-05-15 Kenichi Handa + + * fontset.c (Fnew_fontset): Call font_unparse_xlfd with 256-byte + buffer. Check the return value of it. + 2008-05-14 Jason Rumney * w32term.c (w32_get_glyph_overhangs): Remove. diff --git a/src/fontset.c b/src/fontset.c index e02c833c6c5..82e5b4e65de 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -1557,7 +1557,7 @@ FONT-SPEC is a vector, a cons, or a string. See the documentation of { 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 @@ FONT-SPEC is a vector, a cons, or a string. See the documentation of 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 -- 2.39.5