meson: remote: fix coverity warning

PD#172716: meson: remote: fix coverity warning

The "strncpy" function does not ensure that the
string "ptable->tab.custom_name"ends with a null character.
So,the function "strncpy" is replaced by the function "snprintf".
This causes "Buffer not null terminated".

Change-Id: I4dd7ce89778ba8be7d60f3463e445f5a3a753061
Signed-off-by: Yingyuan Zhu <yingyuan.zhu@amlogic.com>
This commit is contained in:
Yingyuan Zhu
2018-08-29 16:17:30 +08:00
committed by Jianxin Pan
parent ab6c42eeea
commit 99b548faeb

View File

@@ -417,7 +417,7 @@ static int get_custom_tables(struct device_node *node,
dev_err(chip->dev, "please config mapname item\n");
goto err;
}
strncpy(ptable->tab.custom_name, uname, CUSTOM_NAME_LEN);
snprintf(ptable->tab.custom_name, CUSTOM_NAME_LEN, "%s", uname);
dev_info(chip->dev, "ptable->custom_name = %s\n",
ptable->tab.custom_name);