1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-02 13:31:48 +02:00

LocalStore::addToStore(): Check info.narSize

It allowed the client to specify bogus narSize values. In particular,
Downloader::downloadCached wasn't setting narSize at all.
This commit is contained in:
Eelco Dolstra 2017-05-11 13:26:03 +02:00
parent 1fd59447d5
commit 45d7b1a9e9
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
2 changed files with 7 additions and 2 deletions

View file

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