summaryrefslogtreecommitdiff
path: root/nix/libutil/hash.cc
diff options
context:
space:
mode:
Diffstat (limited to 'nix/libutil/hash.cc')
-rw-r--r--nix/libutil/hash.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/nix/libutil/hash.cc b/nix/libutil/hash.cc
index 9b83ffcdd9..3cb4d05318 100644
--- a/nix/libutil/hash.cc
+++ b/nix/libutil/hash.cc
@@ -64,12 +64,12 @@ const string base16Chars = "0123456789abcdef";
string printHash(const Hash & hash)
{
- char buf[hash.hashSize * 2];
+ std::vector<char> buf(hash.hashSize * 2);
for (unsigned int i = 0; i < hash.hashSize; i++) {
buf[i * 2] = base16Chars[hash.hash[i] >> 4];
buf[i * 2 + 1] = base16Chars[hash.hash[i] & 0x0f];
}
- return string(buf, hash.hashSize * 2);
+ return string(buf.begin(), buf.end());
}