Fixed wrong offset in pack_x function; ref #3944

This commit is contained in:
Yukihiro "Matz" Matsumoto
2018-02-13 08:47:33 +09:00
parent 00845ea908
commit c5ec37a8ab
+2 -2
View File
@@ -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;
dst = str_len_ensure(mrb, dst, didx + count);
for (i = didx; i < count; i++) {
RSTRING_PTR(dst)[i] = '\0';
for (i = 0; i < count; i++) {
RSTRING_PTR(dst)[didx + i] = '\0';
}
return count;
}