* term.c (produce_glyphless_glyph): Make sprintf buffer a bit bigger
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 29 Aug 2011 19:47:44 +0000 (12:47 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 29 Aug 2011 19:47:44 +0000 (12:47 -0700)
to avoid potential buffer overrun.

src/ChangeLog
src/term.c

index b1c2936..97d1ea0 100644 (file)
@@ -88,6 +88,9 @@
        * process.c (make_process): Use printmax_t, not int, to format
        process-name gensyms.
 
+       * term.c (produce_glyphless_glyph): Make sprintf buffer a bit bigger
+       to avoid potential buffer overrun.
+
 2011-08-26  Paul Eggert  <eggert@cs.ucla.edu>
 
        Integer and memory overflow issues (Bug#9196).
index f3bf3a9..48d4069 100644 (file)
@@ -1887,7 +1887,7 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym)
 {
   int face_id;
   int len;
-  char buf[9];
+  char buf[sizeof "\\x" + max (6, (sizeof it->c * CHAR_BIT + 3) / 4)];
   char const *str = "    ";
 
   /* Get a face ID for the glyph by utilizing a cache (the same way as