ipmi/watchdog: use strscpy() to instead of strncpy()

Xu Panda <xu.panda@zte.com.cn>

The implementation of strscpy() is more robust and safer.
That's now the recommended way to copy NUL terminated strings.

Signed-off-by: Xu Panda <xu.panda@zte.com.cn>
Signed-off-by: Yang Yang <yang.yang29@zte.com>
Message-Id: <202212051936400309332@zte.com.cn>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
This commit is contained in:
yang.yang29@zte.com.cn 2022-12-05 19:36:40 +08:00 committed by Corey Minyard
parent b8fadb3964
commit c6f613e5f3
1 changed files with 1 additions and 2 deletions

View File

@ -213,8 +213,7 @@ static int set_param_str(const char *val, const struct kernel_param *kp)
char valcp[16]; char valcp[16];
char *s; char *s;
strncpy(valcp, val, 15); strscpy(valcp, val, 16);
valcp[15] = '\0';
s = strstrip(valcp); s = strstrip(valcp);