From 44e86304b611a955f4e934fc160f3f4a0a2b1c92 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 26 Sep 2018 12:03:58 +0200 Subject: Make NAR header check more robust Changes std::bad_alloc into bad archive: input doesn't look like a Nix archive --- src/libutil/archive.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libutil/archive.cc') 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. */ -- cgit v1.2.3