From: Andrew Burt Date: Mon, 25 Jan 1988 23:31:23 +0000 (+0000) Subject: perl 1.0 patch 6: printf doesn't finish processing format string when out of args. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f9ad74367ccb11e91fbda2bb7702039bcde360ce;p=p5sagit%2Fp5-mst-13.2.git perl 1.0 patch 6: printf doesn't finish processing format string when out of args. printf "%% %d %%", 1; produces "% 1 %%", which is counterintuitive. --- diff --git a/arg.c b/arg.c index 1423d91..728f44d 100644 --- a/arg.c +++ b/arg.c @@ -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 51d80f3..fb8ed65 100644 --- a/patchlevel.h +++ b/patchlevel.h @@ -1 +1 @@ -#define PATCHLEVEL 5 +#define PATCHLEVEL 6