diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libutil/serialise.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libutil/serialise.cc b/src/libutil/serialise.cc index 6064e15f5e67..950e6362a245 100644 --- a/src/libutil/serialise.cc +++ b/src/libutil/serialise.cc @@ -207,10 +207,10 @@ size_t readString(unsigned char * buf, size_t max, Source & source) string readString(Source & source) { auto len = readNum<size_t>(source); - auto buf = std::make_unique<unsigned char[]>(len); - source(buf.get(), len); + std::string res(len, 0); + source((unsigned char*) res.data(), len); readPadding(len, source); - return string((char *) buf.get(), len); + return res; } Source & operator >> (Source & in, string & s) |