[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202308101204.BF36493304@keescook>
Date: Thu, 10 Aug 2023 12:05:03 -0700
From: Kees Cook <keescook@...omium.org>
To: Justin Stitt <justinstitt@...gle.com>
Cc: Richard Weinberger <richard@....at>,
Anton Ivanov <anton.ivanov@...bridgegreys.com>,
Johannes Berg <johannes@...solutions.net>,
linux-hardening@...r.kernel.org, linux-um@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] um: refactor deprecated strncpy to memcpy
On Wed, Aug 09, 2023 at 06:19:32PM +0000, Justin Stitt wrote:
> Use `memcpy` since `console_buf` is not expected to be NUL-terminated
> and it more accurately describes what is happening with the buffers
> `console_buf` and `string` as per Kees' analysis [1].
>
> Also mark char buffer as `__nonstring` as per Kees' suggestion [2].
>
> This change now makes it more clear what this code does and that
> `console_buf` is not expected to be NUL-terminated.
>
> Link: https://lore.kernel.org/all/202308081708.D5ADC80F@keescook/ [1]
> Link: https://github.com/KSPP/linux/issues/90 [2]
> Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings
> Cc: linux-hardening@...r.kernel.org
> Suggested-by: Kees Cook <keescook@...omium.org>
> Signed-off-by: Justin Stitt <justinstitt@...gle.com>
Thanks for digging through this!
Reviewed-by: Kees Cook <keescook@...omium.org>
--
Kees Cook
Powered by blists - more mailing lists