From: Steve Hay Date: Wed, 22 Nov 2006 15:11:41 +0000 (+0000) Subject: Fix infinite loop in Perl_my_strftime() for failing strftime() X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7743c30757199ca2f38bf73a40c6d3a6aef6b5ea;p=p5sagit%2Fp5-mst-13.2.git Fix infinite loop in Perl_my_strftime() for failing strftime() p4raw-id: //depot/perl@29350 --- diff --git a/util.c b/util.c index af1e22a..405c921 100644 --- a/util.c +++ b/util.c @@ -3829,7 +3829,7 @@ Perl_my_strftime(pTHX_ const char *fmt, int sec, int min, int hour, int mday, in else { /* Possibly buf overflowed - try again with a bigger buf */ const int fmtlen = strlen(fmt); - const int bufsize = fmtlen + buflen; + int bufsize = fmtlen + buflen; Newx(buf, bufsize, char); while (buf) { @@ -3842,7 +3842,8 @@ Perl_my_strftime(pTHX_ const char *fmt, int sec, int min, int hour, int mday, in buf = NULL; break; } - Renew(buf, bufsize*2, char); + bufsize *= 2; + Renew(buf, bufsize, char); } return buf; }