aboutsummaryrefslogtreecommitdiffstats
path: root/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'time.c')
-rw-r--r--time.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/time.c b/time.c
index dd846a630c..6817c75e1e 100644
--- a/time.c
+++ b/time.c
@@ -4325,8 +4325,12 @@ rb_strftime_alloc(char **buf, const char *format,
* if the buffer is 1024 times bigger than the length of the
* format string, it's not failing for lack of room.
*/
- if (len > 0 || size >= 1024 * flen) break;
+ if (len > 0) break;
xfree(*buf);
+ if (size >= 1024 * flen) {
+ rb_sys_fail(format);
+ break;
+ }
}
return len;
}