mirror of
https://github.com/NixOS/nix
synced 2025-06-27 16:51:15 +02:00
Catch more possible instances of passing NULL to memcpy.
Actually fixes #1976.
This commit is contained in:
parent
d25d9f7cec
commit
cfdbfa6b2c
3 changed files with 10 additions and 4 deletions
|
@ -191,6 +191,7 @@ Hash::Hash(const std::string & s, HashType type)
|
|||
auto d = base64Decode(std::string(s, pos));
|
||||
if (d.size() != hashSize)
|
||||
throw BadHash("invalid base-64 hash '%s'", s);
|
||||
assert(hashSize);
|
||||
memcpy(hash, d.data(), hashSize);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue