mirror of
https://github.com/Tiiffi/mcrcon.git
synced 2025-10-27 03:11:07 -04:00
Don't call memcpy() if there is nothing to copy
This commit is contained in:
2
mcrcon.c
2
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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user