about summary refs log tree commit diff
path: root/src/libutil/serialise.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-09-26T10·03+0200
committerEelco Dolstra <edolstra@gmail.com>2018-09-26T10·03+0200
commit44e86304b611a955f4e934fc160f3f4a0a2b1c92 (patch)
tree4c8388c67886b406bf8b9b07de90b6a3b97167a8 /src/libutil/serialise.hh
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/serialise.hh')
-rw-r--r--src/libutil/serialise.hh2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libutil/serialise.hh b/src/libutil/serialise.hh
index 4b6ad5da5b9c..969e4dff383d 100644
--- a/src/libutil/serialise.hh
+++ b/src/libutil/serialise.hh
@@ -284,7 +284,7 @@ inline uint64_t readLongLong(Source & source)
 
 void readPadding(size_t len, Source & source);
 size_t readString(unsigned char * buf, size_t max, Source & source);
-string readString(Source & source);
+string readString(Source & source, size_t max = std::numeric_limits<size_t>::max());
 template<class T> T readStrings(Source & source);
 
 Source & operator >> (Source & in, string & s);