Hello,
I spotted what appears to be a bug in src/tcp.c, lines 208 (send) and 255 (receive).
In the transmission and reception loops:
// tcp_send (), ligne 208
do {
n = send(tcp_data->server_socket, message + n, length, 0); // <--
...
length -= n;
bytes_sent += n;
} while (length > 0);
// tcp_receive_(), ligne 255
do {
n = recv(tcp_data->server_socket, message + n, length, flags); // <--
...
length -= n;
bytes_received += n;
} while (n > 0);
In both cases, the buffer offset should be cumulative:
- For sending:
message + bytes_sent (and not message + n)
- For reception:
message + bytes_received (and not message + n)
Otherwise, there is a risk of rewriting/rereading in the wrong place, or even corrupting the buffer or looping over the same data.
Please confirm and correct if necessary.
Sincerely,
Signalement automatisé via Copilot Issue Agent.
Hello,
I spotted what appears to be a bug in
src/tcp.c, lines 208 (send) and 255 (receive).In the transmission and reception loops:
In both cases, the buffer offset should be cumulative:
message + bytes_sent(and notmessage + n)message + bytes_received(and notmessage + n)Otherwise, there is a risk of rewriting/rereading in the wrong place, or even corrupting the buffer or looping over the same data.
Please confirm and correct if necessary.
Sincerely,
Signalement automatisé via Copilot Issue Agent.