aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author[email protected] <[email protected]>2022-12-05 19:36:40 +0800
committerCorey Minyard <[email protected]>2022-12-05 06:50:09 -0600
commitc6f613e5f35b0e2154d5ca12f0e8e0be0c19be9a (patch)
tree35ca6ccdb94514fb2f87e37ffbf02b8a43ceb457
parentb8fadb396414972c7e526f3f94c0b4d114d2b2a1 (diff)
ipmi/watchdog: use strscpy() to instead of strncpy()
Xu Panda <[email protected]> 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 <[email protected]> Signed-off-by: Yang Yang <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
-rw-r--r--drivers/char/ipmi/ipmi_watchdog.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c
index 47365150e431..0d4a8dcacfd4 100644
--- a/drivers/char/ipmi/ipmi_watchdog.c
+++ b/drivers/char/ipmi/ipmi_watchdog.c
@@ -213,8 +213,7 @@ static int set_param_str(const char *val, const struct kernel_param *kp)
char valcp[16];
char *s;
- strncpy(valcp, val, 15);
- valcp[15] = '\0';
+ strscpy(valcp, val, 16);
s = strstrip(valcp);