diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2016-02-19 11:46:18 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2016-02-19 11:46:18 +0900 |
| commit | cf5ca03676e59f28fbc89774d61721f64f52fdf5 (patch) | |
| tree | 658104a0b5c5a825d991dca36de7bb901c5e95f4 /mrbgems/mruby-struct/src | |
| parent | 819c9da8d2b37ed85a4a9213e5d596df5f1e4708 (diff) | |
| download | mruby-cf5ca03676e59f28fbc89774d61721f64f52fdf5.tar.gz mruby-cf5ca03676e59f28fbc89774d61721f64f52fdf5.zip | |
mruby-struct: copied Struct length is not initialized; fix #3114
Diffstat (limited to 'mrbgems/mruby-struct/src')
| -rw-r--r-- | mrbgems/mruby-struct/src/struct.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/mrbgems/mruby-struct/src/struct.c b/mrbgems/mruby-struct/src/struct.c index ea91a0436..f084e4031 100644 --- a/mrbgems/mruby-struct/src/struct.c +++ b/mrbgems/mruby-struct/src/struct.c @@ -418,7 +418,6 @@ static mrb_value mrb_struct_init_copy(mrb_state *mrb, mrb_value copy) { mrb_value s; - mrb_int i, len; mrb_get_args(mrb, "o", &s); @@ -429,13 +428,7 @@ mrb_struct_init_copy(mrb_state *mrb, mrb_value copy) if (!mrb_array_p(s)) { mrb_raise(mrb, E_TYPE_ERROR, "corrupted struct"); } - if (RSTRUCT_LEN(copy) != RSTRUCT_LEN(s)) { - mrb_raise(mrb, E_TYPE_ERROR, "struct size mismatch"); - } - len = RSTRUCT_LEN(copy); - for (i = 0; i < len; i++) { - mrb_ary_set(mrb, copy, i, RSTRUCT_PTR(s)[i]); - } + mrb_ary_replace(mrb, copy, s); return copy; } |
