]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix core dump from (format "%#08x" n) patch
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 8 Dec 2017 21:30:06 +0000 (13:30 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 8 Dec 2017 21:30:25 +0000 (13:30 -0800)
Problem reported by Glenn Morris (Bug#29609#13).
* src/editfns.c (styled_format): Null-terminate output,
as later code now expects this.

src/editfns.c

index ebf6518994b93880bc13727e8db4c58e9c496ed8..084d92346f58e862008cf73db944e31ab91d105e 100644 (file)
@@ -4623,6 +4623,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
                  /* Don't use sprintf here, as it might mishandle prec.  */
                  sprintf_buf[0] = XINT (arg);
                  sprintf_bytes = prec != 0;
+                 sprintf_buf[sprintf_bytes] = '\0';
                }
              else if (conversion == 'd' || conversion == 'i')
                {