summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/string.c b/string.c
index 983c2a1166..7f29cea2b6 100644
--- a/string.c
+++ b/string.c
@@ -2098,7 +2098,7 @@ str_buf_cat(VALUE str, const char *ptr, long len)
if (capa <= total) {
while (total > capa) {
if (capa + termlen >= LONG_MAX / 2) {
- capa = (total + 4095) / 4096;
+ capa = (total + 4095) / 4096 * 4096;
break;
}
capa = (capa + termlen) * 2;