[<prev] [next>] [day] [month] [year] [list]
Message-ID: <39b334c4-48e3-47ec-ae31-adeff2bf4839@p183>
Date: Sat, 13 May 2023 13:55:22 +0300
From: Alexey Dobriyan <adobriyan@...il.com>
To: linux-kernel@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, wangkefeng.wang@...wei.com,
lstoakes@...il.com, liushixin2@...wei.com, david@...hat.com,
bhe@...hat.com, azeemshaikh38@...il.com, akpm@...ux-foundation.org
Subject: Re: + procfs-replace-all-non-returning-strlcpy-with-strscpy.patch
added to mm-nonmm-unstable branch
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@...il.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);
Powered by blists - more mailing lists