diff options
author | Steve Hay <SteveHay@planit.com> | 2006-11-22 15:11:41 +0000 |
---|---|---|
committer | Steve Hay <SteveHay@planit.com> | 2006-11-22 15:11:41 +0000 |
commit | 7743c30757199ca2f38bf73a40c6d3a6aef6b5ea (patch) | |
tree | 69776f05ffc80209070837f966722e8f3fd5da7e /util.c | |
parent | a870056241d074c8220de8211d965e13ac2d3c7d (diff) | |
download | perl-7743c30757199ca2f38bf73a40c6d3a6aef6b5ea.tar.gz |
Fix infinite loop in Perl_my_strftime() for failing strftime()
p4raw-id: //depot/perl@29350
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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; } |