From: Kees Cook <keescook@chromium.org>
To: laniel_francis@privacyrequired.com
Cc: linux-hardening@vger.kernel.org, netdev@vger.kernel.org,
davem@davemloft.net, kuba@kernel.org
Subject: Re: [RFC][PATCH v3 2/3] Modify return value of nla_strlcpy to match that of strscpy.
Date: Wed, 21 Oct 2020 16:48:37 -0700 [thread overview]
Message-ID: <202010211648.4CBF3805A9@keescook> (raw)
In-Reply-To: <20201020164707.30402-3-laniel_francis@privacyrequired.com>
On Tue, Oct 20, 2020 at 06:47:06PM +0200, laniel_francis@privacyrequired.com wrote:
> From: Francis Laniel <laniel_francis@privacyrequired.com>
>
> nla_strlcpy now returns -E2BIG if src was truncated when written to dst.
> It also returns this error value if dstsize is 0 or higher than INT_MAX.
>
> For example, if src is "foo\0" and dst is 3 bytes long, the result will be:
> 1. "foG" after memcpy (G means garbage).
> 2. "fo\0" after memset.
> 3. -E2BIG is returned because src was not completely written into dst.
>
> The callers of nla_strlcpy were modified to take into account this modification.
>
> Signed-off-by: Francis Laniel <laniel_francis@privacyrequired.com>
This looks correct to me. Thanks for the respin!
Reviewed-by: Kees Cook <keescook@chromium.org>
--
Kees Cook
next prev parent reply other threads:[~2020-10-21 23:48 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-20 16:47 [RFC][PATCH v3 0/3] Fix inefficiences and rename nla_strlcpy laniel_francis
2020-10-20 16:47 ` [RFC][PATCH v3 1/3] Fix unefficient call to memset before memcpu in nla_strlcpy laniel_francis
2020-10-21 23:46 ` Kees Cook
2020-10-20 16:47 ` [RFC][PATCH v3 2/3] Modify return value of nla_strlcpy to match that of strscpy laniel_francis
2020-10-21 23:48 ` Kees Cook [this message]
2020-10-22 9:40 ` Francis Laniel
2020-10-20 16:47 ` [RFC][PATCH v3 3/3] Rename nla_strlcpy to nla_strscpy laniel_francis
2020-10-21 23:49 ` Kees Cook
2020-10-22 9:41 ` Francis Laniel
2020-10-22 20:04 ` Kees Cook
2020-10-22 23:05 ` Jakub Kicinski
2020-10-23 8:07 ` David Laight
2020-10-23 15:15 ` Francis Laniel
2020-10-23 15:29 ` Jakub Kicinski
2020-10-23 17:41 ` Kees Cook
2020-10-23 15:16 ` Francis Laniel
2020-10-24 10:41 ` Francis Laniel
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=202010211648.4CBF3805A9@keescook \
--to=keescook@chromium.org \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=laniel_francis@privacyrequired.com \
--cc=linux-hardening@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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