aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/archive.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-09-26 12:03:58 +0200
committerEelco Dolstra <edolstra@gmail.com>2018-09-26 12:03:58 +0200
commit44e86304b611a955f4e934fc160f3f4a0a2b1c92 (patch)
tree4c8388c67886b406bf8b9b07de90b6a3b97167a8 /src/libutil/archive.cc
parent7ccdcc7fed154b6621397417354df4e2fd913215 (diff)
Make NAR header check more robust
Changes std::bad_alloc into bad archive: input doesn't look like a Nix archive
Diffstat (limited to 'src/libutil/archive.cc')
-rw-r--r--src/libutil/archive.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libutil/archive.cc b/src/libutil/archive.cc
index 1be8934a2..bb68e8288 100644
--- a/src/libutil/archive.cc
+++ b/src/libutil/archive.cc
@@ -283,7 +283,7 @@ void parseDump(ParseSink & sink, Source & source)
{
string version;
try {
- version = readString(source);
+ version = readString(source, narVersionMagic1.size());
} catch (SerialisationError & e) {
/* This generally means the integer at the start couldn't be
decoded. Ignore and throw the exception below. */