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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user