* Re: + procfs-replace-all-non-returning-strlcpy-with-strscpy.patch added to mm-nonmm-unstable branch
[not found] <20230511043449.99AE6C433EF@smtp.kernel.org>
@ 2023-05-13 10:55 ` Alexey Dobriyan
0 siblings, 0 replies; only message in thread
From: Alexey Dobriyan @ 2023-05-13 10:55 UTC (permalink / raw)
To: linux-kernel
Cc: linux-kernel, wangkefeng.wang, lstoakes, liushixin2, david, bhe,
azeemshaikh38, akpm
On Wed, May 10, 2023 at 09:34:49PM -0700, Andrew Morton wrote:
> Subject: procfs: replace all non-returning strlcpy with strscpy
> strlcpy() reads the entire source buffer first. This read may exceed the
> destination size limit.
> This is both inefficient and can lead to linear read overflows if a source string is not NUL-terminated [1].
This is funny. C strings are always NUL-terminated by definition.
Reviewed-by: Alexey Dobriyan <adobriyan@gmail.com>
> --- a/fs/proc/kcore.c~procfs-replace-all-non-returning-strlcpy-with-strscpy
> +++ a/fs/proc/kcore.c
> @@ -419,7 +419,7 @@ static ssize_t read_kcore_iter(struct ki
> char *notes;
> size_t i = 0;
>
> - strlcpy(prpsinfo.pr_psargs, saved_command_line,
> + strscpy(prpsinfo.pr_psargs, saved_command_line,
> sizeof(prpsinfo.pr_psargs));
>
> notes = kzalloc(notes_len, GFP_KERNEL);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-05-13 10:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20230511043449.99AE6C433EF@smtp.kernel.org>
2023-05-13 10:55 ` + procfs-replace-all-non-returning-strlcpy-with-strscpy.patch added to mm-nonmm-unstable branch Alexey Dobriyan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®