summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorSteve Hay <SteveHay@planit.com>2006-11-22 15:11:41 +0000
committerSteve Hay <SteveHay@planit.com>2006-11-22 15:11:41 +0000
commit7743c30757199ca2f38bf73a40c6d3a6aef6b5ea (patch)
tree69776f05ffc80209070837f966722e8f3fd5da7e /util.c
parenta870056241d074c8220de8211d965e13ac2d3c7d (diff)
downloadperl-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.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/util.c b/util.c
index af1e22a431..405c921a71 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;
}