cppcheck really like us to use snprinft....

This commit is contained in:
iceman1001
2026-03-29 09:42:36 +07:00
parent 000d086d59
commit 94720a4a6c

View File

@@ -144,7 +144,7 @@ static int mqtt_receive(const char *addr, const char *port, const char *topic, c
mqtt_init(&client, sockfd, sendbuf, sizeof(sendbuf), recvbuf, sizeof(recvbuf), mqtt_publish_callback);
char cid[20] = "pm3_";
sprintf(cid + strlen(cid), "%02x%02x%02x%02x"
snprintf(cid + strlen(cid), sizeof(cid) - 4, "%02x%02x%02x%02x"
, rand() % 0xFF
, rand() % 0xFF
, rand() % 0xFF