Messages in this thread | | | Date | Wed, 3 Apr 2024 14:28:36 -0700 | From | Kees Cook <> | Subject | Re: [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
| |