Fixed wrong offset in `pack_x` function; ref #3944

parent 00845ea9
...@@ -835,8 +835,8 @@ pack_x(mrb_state *mrb, mrb_value src, mrb_value dst, mrb_int didx, long count, u ...@@ -835,8 +835,8 @@ pack_x(mrb_state *mrb, mrb_value src, mrb_value dst, mrb_int didx, long count, u
if (count < 0) return 0; if (count < 0) return 0;
dst = str_len_ensure(mrb, dst, didx + count); dst = str_len_ensure(mrb, dst, didx + count);
for (i = didx; i < count; i++) { for (i = 0; i < count; i++) {
RSTRING_PTR(dst)[i] = '\0'; RSTRING_PTR(dst)[didx + i] = '\0';
} }
return count; return count;
} }
......
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