Skip to content
Commit 040bf9a7 authored by Phillip Lougher's avatar Phillip Lougher Committed by Andrew Morton
Browse files

Squashfs: remove deprecated strncpy by not copying the string

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.

Link: https://lkml.kernel.org/r/20240403183352.391308-1-phillip@squashfs.org.uk


Signed-off-by: default avatarPhillip Lougher <phillip@squashfs.org.uk>
Reviewed-by: default avatarKees Cook <keescook@chromium.org>
Reviewed-by: default avatarJustin Stitt <justinstitt@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 029c45bb
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment