str_buf_cat(): should allocate at least RSTRING_EMBED_LEN_MAX+1.

parent cfdd1e3c
...@@ -158,6 +158,8 @@ str_buf_cat(mrb_state *mrb, struct RString *s, const char *ptr, size_t len) ...@@ -158,6 +158,8 @@ str_buf_cat(mrb_state *mrb, struct RString *s, const char *ptr, size_t len)
capa = RSTRING_EMBED_LEN_MAX; capa = RSTRING_EMBED_LEN_MAX;
else else
capa = s->as.heap.aux.capa; capa = s->as.heap.aux.capa;
if (capa <= RSTRING_EMBED_LEN_MAX)
capa = RSTRING_EMBED_LEN_MAX+1;
total = RSTR_LEN(s)+len; total = RSTR_LEN(s)+len;
if (total >= MRB_INT_MAX) { if (total >= MRB_INT_MAX) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment