Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: printf bug



I forgot to allow for printf size modifiers when adding up the size of
the buffer for printf specifications.

Oliver

Index: Src/builtin.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.111
diff -u -r1.111 builtin.c
--- Src/builtin.c	12 Jan 2004 12:09:12 -0000	1.111
+++ Src/builtin.c	7 Mar 2004 13:05:33 -0000
@@ -3151,7 +3151,7 @@
     int flen, width, prec, type, argc, n, narg;
     int nnl = 0, ret = 0, maxarg = 0;
     int flags[5], *len;
-    char *start, *endptr, *c, *d, *flag, *buf, spec[11], *fmt = NULL;
+    char *start, *endptr, *c, *d, *flag, *buf, spec[13], *fmt = NULL;
     char **first, *curarg, *flagch = "0+- #", save = '\0', nullstr = '\0';
     size_t rcount, count = 0;
 #ifdef HAVE_OPEN_MEMSTREAM
Index: Test/B03print.ztst
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/B03print.ztst,v
retrieving revision 1.7
diff -u -r1.7 B03print.ztst
--- Test/B03print.ztst	25 Apr 2003 11:19:10 -0000	1.7
+++ Test/B03print.ztst	7 Mar 2004 13:05:33 -0000
@@ -149,7 +149,7 @@
 0:%n count zeroed on format reuse
 >1
 
-# this should fill spec string with '%0+- #*.*d\0' - 11 characters
+# this may fill spec string with '%0+- #*.*lld\0' - 13 characters
  printf '%1$0+- #-08.5dx\n' 123
 0:maximal length format specification
 >+00123  x



Messages sorted by: Reverse Date, Date, Thread, Author