mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mruby-pack: unpack "b/B" should limit result size
This commit is contained in:
@@ -921,7 +921,7 @@ unpack_bstr(mrb_state *mrb, const void *src, int slen, mrb_value ary, int count,
|
||||
|
||||
const char *sptr0 = (const char*)src;
|
||||
const char *sptr = sptr0;
|
||||
if (count == -1)
|
||||
if (count == -1 || count > slen * 8)
|
||||
count = slen * 8;
|
||||
|
||||
mrb_value dst = mrb_str_new(mrb, NULL, count);
|
||||
|
||||
Reference in New Issue
Block a user