From da5d692f89cdb489d575ce349db6af9da0b66fcd Mon Sep 17 00:00:00 2001 From: Tiiffi Date: Thu, 27 Nov 2025 17:55:23 +0200 Subject: [PATCH] Add byteswap to net_send_packet() function Fixes broken packet size calculation on big endian machines. --- mcrcon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mcrcon.c b/mcrcon.c index 967c33f..4fb88f4 100755 --- a/mcrcon.c +++ b/mcrcon.c @@ -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;