]> code.delx.au - gnu-emacs/commitdiff
(Fformat): Fix allocation size of precision array.
authorKim F. Storm <storm@cua.dk>
Tue, 13 Apr 2004 21:30:16 +0000 (21:30 +0000)
committerKim F. Storm <storm@cua.dk>
Tue, 13 Apr 2004 21:30:16 +0000 (21:30 +0000)
src/editfns.c

index ce075f2696c233d209d159f326fcfa21e5a557cf..a5c3aea14bc75b0518ff279029f3bd56372b0026 100644 (file)
@@ -3220,7 +3220,7 @@ usage: (format STRING &rest OBJECTS)  */)
      string itself, will not be used.  Element NARGS, corresponding to
      no argument, *will* be assigned to in the case that a `%' and `.'
      occur after the final format specifier.  */
-  int *precision = (int *) (alloca(nargs * sizeof (int)));
+  int *precision = (int *) (alloca((nargs + 1) * sizeof (int)));
   int longest_format;
   Lisp_Object val;
   int arg_intervals = 0;
@@ -3274,7 +3274,7 @@ usage: (format STRING &rest OBJECTS)  */)
   /* Make room in result for all the non-%-codes in the control string.  */
   total = 5 + CONVERTED_BYTE_SIZE (multibyte, args[0]);
 
-  /* Allocate the info and discarded tables.  */ 
+  /* Allocate the info and discarded tables.  */
   {
     int nbytes = nargs * sizeof *info;
     int i;