From 99b548faeba7bcc7c2214614c49152cf735faf14 Mon Sep 17 00:00:00 2001 From: Yingyuan Zhu Date: Wed, 29 Aug 2018 16:17:30 +0800 Subject: [PATCH] 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 --- drivers/amlogic/input/remote/remote_meson.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/amlogic/input/remote/remote_meson.c b/drivers/amlogic/input/remote/remote_meson.c index b321e3fa5719..43a360d1ac65 100644 --- a/drivers/amlogic/input/remote/remote_meson.c +++ b/drivers/amlogic/input/remote/remote_meson.c @@ -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);