From cfdbfa6b2cc27ae5b98c5f27599bbc0fc6a104c1 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Wed, 14 Mar 2018 23:53:43 -0400 Subject: Catch more possible instances of passing NULL to memcpy. Actually fixes #1976. --- src/libutil/hash.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'src/libutil/hash.cc') diff --git a/src/libutil/hash.cc b/src/libutil/hash.cc index 75e476755..150995f55 100644 --- a/src/libutil/hash.cc +++ b/src/libutil/hash.cc @@ -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); } -- cgit v1.2.3