summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/date/date_core.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/date/date_core.c b/ext/date/date_core.c
index 6474074028..c78eda47a9 100644
--- a/ext/date/date_core.c
+++ b/ext/date/date_core.c
@@ -6721,8 +6721,12 @@ date_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;
}