Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'modules-6.17-rc3.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/modules/linux

Pull modules fix from Daniel Gomez:
"This includes a fix part of the KSPP (Kernel Self Protection Project)
to replace the deprecated and unsafe strcpy() calls in the kernel
parameter string handler and sysfs parameters for built-in modules.
Single commit, no functional changes"

* tag 'modules-6.17-rc3.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/modules/linux:
params: Replace deprecated strcpy() with strscpy() and memcpy()

+4 -3
+4 -3
kernel/params.c
··· 513 513 int param_set_copystring(const char *val, const struct kernel_param *kp) 514 514 { 515 515 const struct kparam_string *kps = kp->str; 516 + const size_t len = strnlen(val, kps->maxlen); 516 517 517 - if (strnlen(val, kps->maxlen) == kps->maxlen) { 518 + if (len == kps->maxlen) { 518 519 pr_err("%s: string doesn't fit in %u chars.\n", 519 520 kp->name, kps->maxlen-1); 520 521 return -ENOSPC; 521 522 } 522 - strcpy(kps->string, val); 523 + memcpy(kps->string, val, len + 1); 523 524 return 0; 524 525 } 525 526 EXPORT_SYMBOL(param_set_copystring); ··· 842 841 dot = strchr(kp->name, '.'); 843 842 if (!dot) { 844 843 /* This happens for core_param() */ 845 - strcpy(modname, "kernel"); 844 + strscpy(modname, "kernel"); 846 845 name_len = 0; 847 846 } else { 848 847 name_len = dot - kp->name + 1;