mirror of
https://github.com/janet-lang/janet
synced 2024-12-27 00:40:26 +00:00
Merge pull request #826 from rick2600/fix-uaf-cfun_array_concat
fix issue #825
This commit is contained in:
commit
e48ca1a03f
@ -241,6 +241,11 @@ JANET_CORE_FN(cfun_array_concat,
|
||||
int32_t j, len = 0;
|
||||
const Janet *vals = NULL;
|
||||
janet_indexed_view(argv[i], &vals, &len);
|
||||
if (array->data == vals) {
|
||||
int32_t newcount = array->count + len;
|
||||
janet_array_ensure(array, newcount, 2);
|
||||
janet_indexed_view(argv[i], &vals, &len);
|
||||
}
|
||||
for (j = 0; j < len; j++)
|
||||
janet_array_push(array, vals[j]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user