From: Kees Cook <keescook@chromium.org>
To: Phillip Lougher <phillip@squashfs.org.uk>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
justinstitt@google.com
Subject: Re: [PATCH] Squashfs: remove deprecated strncpy by not copying the string
Date: Wed, 3 Apr 2024 14:28:36 -0700 [thread overview]
Message-ID: <202404031428.867B90D87D@keescook> (raw)
In-Reply-To: <20240403183352.391308-1-phillip@squashfs.org.uk>
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
next prev parent reply other threads:[~2024-04-03 21:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-03 18:33 [PATCH] Squashfs: remove deprecated strncpy by not copying the string Phillip Lougher
2024-04-03 21:28 ` Kees Cook [this message]
2024-04-04 0:24 ` Justin Stitt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202404031428.867B90D87D@keescook \
--to=keescook@chromium.org \
--cc=akpm@linux-foundation.org \
--cc=justinstitt@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=phillip@squashfs.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox