lkml.org 
[lkml]   [2024]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Squashfs: remove deprecated strncpy by not copying the string
On Wed, Apr 03, 2024 at 07:33:52PM +0100, Phillip Lougher wrote:
> Squashfs copied the passed string (name) into a temporary buffer
> to ensure it was NUL-terminated. This however is completely
> unnecessary as the string is already NUL-terminated. So remove
> the deprecated strncpy() by completely removing the string copy.
>
> The background behind this unnecessary string copy is that it
> dates back to the days when Squashfs was an out of kernel patch.
> The code deliberately did not assume the string was NUL-terminated
> in case in future this changed (due to kernel changes). This
> would mean the out of tree patches would be broken but still
> compile OK.
>
> Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>

Thanks!

Reviewed-by: Kees Cook <keescook@chromium.org>

--
Kees Cook

\
 
 \ /
  Last update: 2024-05-27 16:22    [W:0.036 / U:0.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site