From: Paulo Alcantara <pc@cjr.nz>
To: Len Baker <len.baker@gmx.com>, Steve French <sfrench@samba.org>,
Jeff Layton <jlayton@kernel.org>,
Suresh Jayaraman <sjayaraman@suse.de>
Cc: Len Baker <len.baker@gmx.com>,
linux-cifs@vger.kernel.org, samba-technical@lists.samba.org,
linux-kernel@vger.kernel.org, Kees Cook <keescook@chromium.org>,
linux-hardening@vger.kernel.org
Subject: Re: [PATCH] CIFS: Fix a potencially linear read overflow
Date: Tue, 17 Aug 2021 21:28:40 -0300 [thread overview]
Message-ID: <87im03h9zb.fsf@cjr.nz> (raw)
In-Reply-To: <20210817102709.15046-1-len.baker@gmx.com>
Len Baker <len.baker@gmx.com> writes:
> strlcpy() reads the entire source buffer first. This read may exceed the
> destination size limit. This is both inefficient and can lead to linear
> read overflows if a source string is not NUL-terminated.
>
> Also, the strnlen() call does not avoid the read overflow in the strlcpy
> function when a not NUL-terminated string is passed.
>
> So, replace this block by a call to kstrndup() that avoids this type of
> overflow and does the same.
>
> Fixes: 066ce6899484d ("cifs: rename cifs_strlcpy_to_host and make it use new functions")
> Signed-off-by: Len Baker <len.baker@gmx.com>
> ---
> fs/cifs/cifs_unicode.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
next prev parent reply other threads:[~2021-08-18 0:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-17 10:27 Len Baker
2021-08-18 0:28 ` Paulo Alcantara [this message]
2021-08-18 2:46 ` Steve French
2021-08-18 13:21 ` Jeff Layton
2021-08-20 5:58 ` Steve French
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=87im03h9zb.fsf@cjr.nz \
--to=pc@cjr.nz \
--cc=jlayton@kernel.org \
--cc=keescook@chromium.org \
--cc=len.baker@gmx.com \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=samba-technical@lists.samba.org \
--cc=sfrench@samba.org \
--cc=sjayaraman@suse.de \
--subject='Re: [PATCH] CIFS: Fix a potencially linear read overflow' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).