diff --git a/src/remote.cc b/src/remote.cc index 0c4ed900..9dcae5f5 100644 --- a/src/remote.cc +++ b/src/remote.cc @@ -158,12 +158,13 @@ template<> String read(int socket) { ByteCount length = read(socket); - if (length == 0) - return String{}; - char buffer[2048]; - kak_assert(length < 2048); - read(socket, buffer, (int)length); - return String(buffer, buffer+(int)length); + String res; + if (length > 0) + { + res.resize((int)length); + read(socket, &res[0], (int)length); + } + return res; } template