From 336f52866849d98dd7ac7e30d1993f92d5c13c93 Mon Sep 17 00:00:00 2001 From: Addison G Date: Wed, 12 Aug 2020 14:10:58 +1000 Subject: [PATCH] Fixed compiler bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes the compiler issue: ``` mcrcon.c: In function ‘packet_build’: mcrcon.c:576:2: warning: ‘strncpy’ specified bound 4096 equals destination size [-Wstringop-truncation] strncpy(packet.data, s1, DATA_BUFFSIZE); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` --- mcrcon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mcrcon.c b/mcrcon.c index 3324875..5cf5ffe 100644 --- a/mcrcon.c +++ b/mcrcon.c @@ -573,7 +573,7 @@ rc_packet *packet_build(int id, int cmd, char *s1) packet.size = sizeof(int) * 2 + s1_len + 2; packet.id = id; packet.cmd = cmd; - strncpy(packet.data, s1, DATA_BUFFSIZE); + strncpy(packet.data, s1, DATA_BUFFSIZE - 1); return &packet; }