[misc]: Terminate soc_name to fix out of bounds

1. Terminate soc_name string to fix memory out of bounds
2. Fix all snprintf/strnlen warning

Change-Id: I4525c6e289a00d1509bc30ee69545d92f2f4b9cb
Signed-off-by: Shunqian Zheng <zhengsq@rock-chips.com>
This commit is contained in:
Shunqian Zheng
2020-04-28 11:27:14 +08:00
committed by Herman Chen
parent 32689b3708
commit 9464af395b
5 changed files with 12 additions and 8 deletions

View File

@@ -68,7 +68,7 @@ MPP_RET mpi_enc_test_cmd_update_by_args(MpiEncTestArgs* cmd, int argc, char **ar
size_t len = strnlen(next, MAX_FILE_NAME_LENGTH);
if (len) {
cmd->file_input = mpp_calloc(char, len + 1);
strncpy(cmd->file_input, next, len);
strcpy(cmd->file_input, next);
name_to_frame_format(cmd->file_input, &cmd->format);
}
} else {
@@ -81,7 +81,7 @@ MPP_RET mpi_enc_test_cmd_update_by_args(MpiEncTestArgs* cmd, int argc, char **ar
size_t len = strnlen(next, MAX_FILE_NAME_LENGTH);
if (len) {
cmd->file_output = mpp_calloc(char, len + 1);
strncpy(cmd->file_output, next, len);
strcpy(cmd->file_output, next);
name_to_coding_type(cmd->file_output, &cmd->type);
}
} else {