changeset 56560:1a84eb100ef3

(Fformat): Allocated extra (dummy) element in info.
author Kim F. Storm <storm@cua.dk>
date Fri, 30 Jul 2004 12:05:08 +0000
parents ac573231cc6d
children 9e3e4cc5d4ad
files src/editfns.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/editfns.c	Thu Jul 29 01:49:07 2004 +0000
+++ b/src/editfns.c	Fri Jul 30 12:05:08 2004 +0000
@@ -3254,6 +3254,7 @@
       /* Piggyback on this loop to initialize precision[N]. */
       precision[n] = -1;
     }
+  precision[nargs] = -1;
 
   CHECK_STRING (args[0]);
   /* We may have to change "%S" to "%s". */
@@ -3277,11 +3278,11 @@
 
   /* Allocate the info and discarded tables.  */
   {
-    int nbytes = nargs * sizeof *info;
+    int nbytes = (nargs+1) * sizeof *info;
     int i;
     info = (struct info *) alloca (nbytes);
     bzero (info, nbytes);
-    for (i = 0; i < nargs; i++)
+    for (i = 0; i <= nargs; i++)
       info[i].start = -1;
     discarded = (char *) alloca (SBYTES (args[0]));
     bzero (discarded, SBYTES (args[0]));