From: David Laight <David.Laight@ACULAB.COM>
To: 'Borislav Petkov' <bp@alien8.de>, Len Baker <len.baker@gmx.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
Tony Luck <tony.luck@intel.com>,
James Morse <james.morse@arm.com>,
Robert Richter <rric@kernel.org>, Joe Perches <joe@perches.com>,
Kees Cook <keescook@chromium.org>,
"linux-hardening@vger.kernel.org"
<linux-hardening@vger.kernel.org>,
"linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v4] EDAC/mc: Prefer strscpy over strcpy
Date: Wed, 25 Aug 2021 08:48:03 +0000 [thread overview]
Message-ID: <a45274ec2e454323a37cde36bb365e97@AcuMS.aculab.com> (raw)
In-Reply-To: <YSU5wp/ZpsXuDgmu@zn.tnic>
From: Borislav Petkov
> Sent: 24 August 2021 19:26
..
> so looking at the code, we're merrily decrementing len but nothing's
> checking whether len can become 0. Because if it does, strscpy() will
> do:
>
> if (count == 0 || WARN_ON_ONCE(count > INT_MAX))
> return -E2BIG;
That -E2BIG is going to break something.
It means that you always have to do an error check whenever
you use the return value of strscpy().
Anything that does:
offset += strscpy(...)
is broken.
It really wasn't a good idea for reporting 'truncated'.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2021-08-25 8:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-14 7:55 [PATCH v4] EDAC/mc: Prefer strscpy over strcpy Len Baker
2021-08-23 17:30 ` Borislav Petkov
2021-08-24 10:28 ` Len Baker
2021-08-24 18:26 ` Borislav Petkov
2021-08-24 19:05 ` Joe Perches
2021-08-25 8:48 ` David Laight [this message]
2021-08-27 17:36 ` Len Baker
2021-08-27 17:54 ` Borislav Petkov
2021-08-27 19:08 ` Joe Perches
2021-08-29 16:14 ` Len Baker
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=a45274ec2e454323a37cde36bb365e97@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=bp@alien8.de \
--cc=james.morse@arm.com \
--cc=joe@perches.com \
--cc=keescook@chromium.org \
--cc=len.baker@gmx.com \
--cc=linux-edac@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=rric@kernel.org \
--cc=tony.luck@intel.com \
/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;
as well as URLs for NNTP newsgroup(s).