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.
Unified · Split
| @@ -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 | ||