mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-27 00:06:16 +02:00
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
1 changed files with 2 additions and 1 deletions
|
@ -1316,7 +1316,8 @@ void EvalState::concatLists(Value & v, unsigned int nrLists, Value * * lists, co
|
||||||
auto out = v.listElems();
|
auto out = v.listElems();
|
||||||
for (unsigned int n = 0, pos = 0; n < nrLists; ++n) {
|
for (unsigned int n = 0, pos = 0; n < nrLists; ++n) {
|
||||||
unsigned int l = lists[n]->listSize();
|
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;
|
pos += l;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue