From: David Laight <David.Laight@ACULAB.COM>
To: 'Kees Cook' <keescook@chromium.org>,
Andy Shevchenko <andy@kernel.org>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: "linux-hardening@vger.kernel.org"
<linux-hardening@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [RFC] string: Allow 2-argument strscpy()
Date: Thu, 1 Feb 2024 22:29:37 +0000 [thread overview]
Message-ID: <9dae4c62fc164abeaa7915f9e53fdb28@AcuMS.aculab.com> (raw)
In-Reply-To: <20240129202901.work.282-kees@kernel.org>
From: Kees Cook
> Sent: 29 January 2024 20:29
>
> Using sizeof(dst) is the overwhelmingly common case for strscpy().
> Instead of requiring this everywhere, allow a 2-argument version to be
> used that will use the sizeof() internally.
You may want to (try to) add a check that the first argument is
actually an array rather than just a pointer.
But the cpp output bloat can get silly and slow the build down.
I guess no one would do:
x = min(strscpy(a, b), strscpy(c, d));
but you can never tell :-)
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
prev parent reply other threads:[~2024-02-01 22:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-29 20:29 [RFC] string: Allow 2-argument strscpy() Kees Cook
2024-01-29 21:55 ` Justin Stitt
2024-01-29 22:02 ` Kees Cook
2024-01-29 23:27 ` Andy Shevchenko
2024-01-29 23:30 ` Andy Shevchenko
2024-02-07 17:51 ` Pavel Machek
2024-02-10 13:02 ` David Laight
2024-02-10 13:51 ` David Laight
2024-02-01 22:29 ` David Laight [this message]
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=9dae4c62fc164abeaa7915f9e53fdb28@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=andy@kernel.org \
--cc=keescook@chromium.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
/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