aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-09-14 03:38:14 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-12-16 16:49:16 +0000
commit05e4733b0075191587c38810f5e85d46f6ebaebb (patch)
treeb5515daf9efac0eb6867184da732893c7818d2bf
parent77f708a6788464c29c5f31862c241913398bf4cf (diff)
downloadruby-05e4733b0075191587c38810f5e85d46f6ebaebb.tar.gz
string.c: add missing size_t cast
Add size_t cast to avoid signed integer overflow. r56157 ("string.c: avoid signed integer overflow", 2016-09-13) missed this.
-rw-r--r--string.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/string.c b/string.c
index 04737f0..f9a93fd 100644
--- a/string.c
+++ b/string.c
@@ -130,7 +130,7 @@ VALUE rb_cSymbol;
#define RESIZE_CAPA_TERM(str,capacity,termlen) do {\
if (STR_EMBED_P(str)) {\
if (!STR_EMBEDDABLE_P(capacity, termlen)) {\
- char *const tmp = ALLOC_N(char, (capacity)+termlen);\
+ char *const tmp = ALLOC_N(char, (size_t)(capacity) + (termlen));\
const long tlen = RSTRING_LEN(str);\
memcpy(tmp, RSTRING_PTR(str), tlen);\
RSTRING(str)->as.heap.ptr = tmp;\