about summary refs log tree commit diff stats
path: root/091socket.cc
diff options
context:
space:
mode:
Diffstat (limited to '091socket.cc')
-rw-r--r--091socket.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/091socket.cc b/091socket.cc
index 51790bdf..e268a022 100644
--- a/091socket.cc
+++ b/091socket.cc
@@ -261,10 +261,10 @@ case _READ_FROM_SOCKET: {
     socket->polled = true;
   }
   int bytes = static_cast<int>(ingredients.at(1).at(0));
-  char* contents = new char[bytes];
-  bzero(contents, bytes);
+  char* contents = new char[bytes+/*terminal null*/1];
+  bzero(contents, bytes+/*terminal null*/1);
   int error_code = 0;
-  int bytes_read = recv(socket->fd, contents, bytes-/*terminal null*/1, MSG_DONTWAIT);
+  int bytes_read = recv(socket->fd, contents, bytes, MSG_DONTWAIT);
   if (bytes_read < 0) error_code = errno;
 //?   if (error_code) {
 //?     ostringstream out;