about summary refs log tree commit diff
path: root/src/libstore/download.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-05-11T11·26+0200
committerEelco Dolstra <edolstra@gmail.com>2017-05-11T11·26+0200
commit45d7b1a9e9018a2be5add1dc6d983e6b7b339c61 (patch)
tree754e96286544bbdf055099712fe19523c61f46cf /src/libstore/download.cc
parent1fd59447d56a88add8874f9a8b0885a1acd13606 (diff)
LocalStore::addToStore(): Check info.narSize
It allowed the client to specify bogus narSize values. In particular,
Downloader::downloadCached wasn't setting narSize at all.
Diffstat (limited to 'src/libstore/download.cc')
-rw-r--r--src/libstore/download.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libstore/download.cc b/src/libstore/download.cc
index 4d502219ed86..93519ec663a7 100644
--- a/src/libstore/download.cc
+++ b/src/libstore/download.cc
@@ -652,6 +652,7 @@ Path Downloader::downloadCached(ref<Store> store, const string & url_, bool unpa
                 Hash hash = hashString(expectedHash ? expectedHash.type : htSHA256, *res.data);
                 info.path = store->makeFixedOutputPath(false, hash, name);
                 info.narHash = hashString(htSHA256, *sink.s);
+                info.narSize = sink.s->size();
                 info.ca = makeFixedOutputCA(false, hash);
                 store->addToStore(info, sink.s, false, true);
                 storePath = info.path;