about summary refs log tree commit diff
path: root/src/libutil/hash.cc
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2018-03-15T03·53-0400
committerShea Levy <shea@shealevy.com>2018-03-15T03·53-0400
commitcfdbfa6b2cc27ae5b98c5f27599bbc0fc6a104c1 (patch)
treefa0e753bcbb8091d6768b737eb6bf58897335d73 /src/libutil/hash.cc
parentd25d9f7cecad24e16b8e831077996e3b50c04468 (diff)
Catch more possible instances of passing NULL to memcpy.
Actually fixes #1976.
Diffstat (limited to 'src/libutil/hash.cc')
-rw-r--r--src/libutil/hash.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libutil/hash.cc b/src/libutil/hash.cc
index 75e4767550f7..150995f55f93 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);
     }