diff --git a/src/conn_sock.c b/src/conn_sock.c index e5322c22..d5a0210e 100644 --- a/src/conn_sock.c +++ b/src/conn_sock.c @@ -416,9 +416,9 @@ static gboolean read_remote_sock(struct remote_sock_s *sock) } if (SOCK_IS_STREAM(sock->sock_type)) { - num_read = read(sock->fd, sock->buf, CONN_SOCK_BUF_SIZE - 1); + num_read = read(sock->fd, sock->buf, CONN_SOCK_BUF_SIZE); } else { - num_read = recvfrom(sock->fd, sock->buf, CONN_SOCK_BUF_SIZE - 1, 0, NULL, NULL); + num_read = recvfrom(sock->fd, sock->buf, CONN_SOCK_BUF_SIZE, 0, NULL, NULL); } if (num_read < 0) diff --git a/src/conn_sock.h b/src/conn_sock.h index bf5f6f39..c519cb93 100644 --- a/src/conn_sock.h +++ b/src/conn_sock.h @@ -36,7 +36,7 @@ struct remote_sock_s { gboolean writable; size_t remaining; size_t off; - char buf[CONN_SOCK_BUF_SIZE]; + char buf[CONN_SOCK_BUF_SIZE+1]; // Extra byte allows null-termination }; struct local_sock_s {