1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 00:11:17 +02:00

Catch more possible instances of passing NULL to memcpy.

Actually fixes #1976.
This commit is contained in:
Shea Levy 2018-03-14 23:53:43 -04:00
parent d25d9f7cec
commit cfdbfa6b2c
No known key found for this signature in database
GPG key ID: 5C0BD6957D86FE27
3 changed files with 10 additions and 4 deletions

View file

@ -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);
}