From 5d1c87b26f2e42430a66081b58580a075cadadf0 Mon Sep 17 00:00:00 2001 From: Tiiffi Date: Wed, 4 Dec 2024 08:17:56 +0200 Subject: [PATCH] Don't call memcpy() if there is nothing to copy --- mcrcon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mcrcon.c b/mcrcon.c index 280d534..944019d 100644 --- a/mcrcon.c +++ b/mcrcon.c @@ -547,7 +547,7 @@ rc_packet *packet_build(int id, int cmd, char s[static 1]) packet.size = sizeof packet.id + sizeof packet.cmd + len + 2; packet.id = id; packet.cmd = cmd; - memcpy(packet.data, s, len); + if (packet.size > 0) memcpy(packet.data, s, len); packet.data[len] = 0; packet.data[len + 1] = 0;