[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202010201019.7BFEC3D@keescook>
Date: Tue, 20 Oct 2020 10:19:52 -0700
From: Kees Cook <keescook@...omium.org>
To: Jakub Kicinski <kuba@...nel.org>
Cc: laniel_francis@...vacyrequired.com,
linux-hardening@...r.kernel.org, davem@...emloft.net
Subject: Re: [RFC][PATCH v2 2/3] Modify return value of nla_strlcpy to match
that of strscpy.
On Mon, Oct 19, 2020 at 04:34:49PM -0700, Jakub Kicinski wrote:
> On Mon, 19 Oct 2020 16:01:27 -0700 Kees Cook wrote:
> > On Mon, Oct 19, 2020 at 09:43:55AM -0700, Jakub Kicinski wrote:
> > > On Mon, 19 Oct 2020 17:23:30 +0200 laniel_francis@...vacyrequired.com
> > > wrote:
> > > > -size_t nla_strlcpy(char *dst, const struct nlattr *nla, size_t dstsize)
> > > > +ssize_t nla_strlcpy(char *dst, const struct nlattr *nla, size_t dstsize)
> > > > {
> > > > + size_t len;
> > > > + ssize_t ret;
> > > > size_t srclen = nla_len(nla);
> > > > char *src = nla_data(nla);
> > >
> > > Sort local variables long to short.
> >
> > Specifically, "reverse christmas tree":
> >
> > size_t srclen = nla_len(nla);
> > char *src = nla_data(nla);
> > size_t len;
> > ssize_t ret;
>
> Or even
>
> size_t srclen = nla_len(nla);
> char *src = nla_data(nla);
> ssize_t ret;
> size_t len;
>
> ;)
Oops, sorry, yes. ENOCOFFEE on my end. :)
--
Kees Cook
Powered by blists - more mailing lists