Add byteswap to net_send_packet() function

Fixes broken packet size calculation on big endian machines.
This commit is contained in:
Tiiffi
2025-11-27 17:55:23 +02:00
parent b03cc2b236
commit da5d692f89

View File

@@ -401,7 +401,8 @@ int net_connect(const char *host, const char *port)
bool net_send_packet(int sd, rc_packet *packet)
{
size_t sent = 0;
size_t size = (size_t) packet->size + (ssize_t) sizeof(int32_t);
size_t packet_size = bswap32(packet->size);
size_t size = packet_size + (ssize_t) sizeof(int32_t);
size_t left = size;
char *p = (char *) packet;