Fix Coverity Scan CID 60277 (Calling strncpy with a maximum size argument of 4096 bytes on destination array user_api_id->recv_buffer of size 4096 bytes might leave the destination string unterminated.)

This commit is contained in:
Dong Anyuan
2019-06-20 12:38:33 +09:00
parent 4eb0344714
commit 7cf75c6d50
+1 -1
View File
@@ -276,7 +276,7 @@ int user_api_set_data(user_api_id_t *user_api_id, char *message)
memset(user_api_id->recv_buffer, 0, USER_API_RECV_BUFFER_SIZE);
strncpy(user_api_id->recv_buffer, message, USER_API_RECV_BUFFER_SIZE);
strncpy(user_api_id->recv_buffer, message, USER_API_RECV_BUFFER_SIZE - 1);
rbytes = strlen(user_api_id->recv_buffer);
LOG_TRACE(INFO, "USR-API - %d bytes write", rbytes);