diff options
author | Andrew Burt <isis!aburt> | 1988-01-25 23:31:23 +0000 |
---|---|---|
committer | Larry Wall <lwall@jpl-devvax.jpl.nasa.gov> | 1988-01-25 23:31:23 +0000 |
commit | f9ad74367ccb11e91fbda2bb7702039bcde360ce (patch) | |
tree | c599962a665e41d2306c945b66de9bdb4ba58a06 | |
parent | be04251a8346b991e162b668d84d5cf1aa6e8501 (diff) | |
download | perl-f9ad74367ccb11e91fbda2bb7702039bcde360ce.tar.gz |
perl 1.0 patch 6: printf doesn't finish processing format string when out of args.
printf "%% %d %%", 1; produces "% 1 %%", which is counterintuitive.
-rw-r--r-- | arg.c | 12 | ||||
-rw-r--r-- | patchlevel.h | 2 |
2 files changed, 11 insertions, 3 deletions
@@ -1,6 +1,9 @@ -/* $Header: arg.c,v 1.0.1.2 88/01/24 03:52:34 root Exp $ +/* $Header: arg.c,v 1.0.1.3 88/01/26 12:30:33 root Exp $ * * $Log: arg.c,v $ + * Revision 1.0.1.3 88/01/26 12:30:33 root + * patch 6: sprintf didn't finish processing format string when out of args. + * * Revision 1.0.1.2 88/01/24 03:52:34 root * patch 2: added STATBLKS dependencies. * @@ -646,11 +649,16 @@ register STR **sarg; register char *t; bool dolong; char ch; + static STR *sargnull = &str_no; str_set(str,""); len--; /* don't count pattern string */ sarg++; - for (s = str_get(*(sarg++)); *sarg && *s && len; len--) { + for (s = str_get(*(sarg++)); *s; len--) { + if (len <= 0 || !*sarg) { + sarg = &sargnull; + len = 0; + } dolong = FALSE; for (t = s; *t && *t != '%'; t++) ; if (!*t) diff --git a/patchlevel.h b/patchlevel.h index 51d80f3b8e..fb8ed65ede 100644 --- a/patchlevel.h +++ b/patchlevel.h @@ -1 +1 @@ -#define PATCHLEVEL 5 +#define PATCHLEVEL 6 |