History

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.

yang.yang29@zte.com.cn committed 3 years ago

Commit c6f613e1 parent b8fadb31 file · +1 −2Browse files

Unified · Split

drivers/char/ipmi/ipmi_watchdog.c+1−2
@@ -213,8 +213,7 @@ static int set_param_str(const char *val, const struct kernel_param *kp) · 212 unmodified lines
213 char valcp[16];213 char valcp[16];
214 char *s;214 char *s;
215 215
216 strncpy(valcp, val, 15);216 strscpy(valcp, val, 16);
217 valcp[15] = '\0';
218 217
219 s = strstrip(valcp);218 s = strstrip(valcp);
220 219