Skip to content

Commit 311c053

Browse files
authored
Merge pull request #470 from alexlarsson/fix-socket-size
Fix podman tests
2 parents a3df678 + 26053bd commit 311c053

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/conn_sock.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -416,9 +416,9 @@ static gboolean read_remote_sock(struct remote_sock_s *sock)
416416
}
417417

418418
if (SOCK_IS_STREAM(sock->sock_type)) {
419-
num_read = read(sock->fd, sock->buf, CONN_SOCK_BUF_SIZE - 1);
419+
num_read = read(sock->fd, sock->buf, CONN_SOCK_BUF_SIZE);
420420
} else {
421-
num_read = recvfrom(sock->fd, sock->buf, CONN_SOCK_BUF_SIZE - 1, 0, NULL, NULL);
421+
num_read = recvfrom(sock->fd, sock->buf, CONN_SOCK_BUF_SIZE, 0, NULL, NULL);
422422
}
423423

424424
if (num_read < 0)

src/conn_sock.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct remote_sock_s {
3636
gboolean writable;
3737
size_t remaining;
3838
size_t off;
39-
char buf[CONN_SOCK_BUF_SIZE];
39+
char buf[CONN_SOCK_BUF_SIZE + 1]; // Extra byte allows null-termination
4040
};
4141

4242
struct local_sock_s {

0 commit comments

Comments
 (0)