mirror of
https://github.com/Tiiffi/mcrcon.git
synced 2025-10-27 11:21:07 -04:00
Fixed compiler bug
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); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ```
This commit is contained in:
2
mcrcon.c
2
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.size = sizeof(int) * 2 + s1_len + 2;
|
||||||
packet.id = id;
|
packet.id = id;
|
||||||
packet.cmd = cmd;
|
packet.cmd = cmd;
|
||||||
strncpy(packet.data, s1, DATA_BUFFSIZE);
|
strncpy(packet.data, s1, DATA_BUFFSIZE - 1);
|
||||||
|
|
||||||
return &packet;
|
return &packet;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user