forked from lix-project/lix
concatLists: Don't pass NULL pointers to memcpy.
This is UB, even if the size is 0. See #1976. Fixes #1976.
This commit is contained in:
parent
55aa622fb1
commit
e2088febf3
|
@ -1316,7 +1316,8 @@ void EvalState::concatLists(Value & v, unsigned int nrLists, Value * * lists, co
|
|||
auto out = v.listElems();
|
||||
for (unsigned int n = 0, pos = 0; n < nrLists; ++n) {
|
||||
unsigned int l = lists[n]->listSize();
|
||||
memcpy(out + pos, lists[n]->listElems(), l * sizeof(Value *));
|
||||
if (l)
|
||||
memcpy(out + pos, lists[n]->listElems(), l * sizeof(Value *));
|
||||
pos += l;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue