[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <201909060851.36ACDB23A@keescook>
Date: Fri, 6 Sep 2019 08:53:37 -0700
From: Kees Cook <keescook@...omium.org>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: "J. Bruce Fields" <bfields@...hat.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/9] rtl8192*: display ESSIDs using %pE
On Fri, Sep 06, 2019 at 12:38:29PM +0300, Andy Shevchenko wrote:
> On Thu, Sep 05, 2019 at 01:53:43PM -0700, Kees Cook wrote:
> > On Thu, Sep 05, 2019 at 03:44:25PM -0400, J. Bruce Fields wrote:
> > > From: "J. Bruce Fields" <bfields@...hat.com>
> > >
> > > Everywhere else in the kernel ESSIDs are printed using %pE, and I can't
> > > see why there should be an exception here.
> >
> > I would expand this rationale slightly: using "n" here makes no sense
> > because they are already NUL-terminated strings. The "n" modifier could
> > only be used with string_escape_mem() which takes a "length" argument.
>
> SSID may have NUL in any location in the name.
Oops, you're totally right: I forgot the "*" part here. Ignore my
comment. :)
So, instead, this "upgrades" the escaping from "only NULL" to all the
unprintables.
>
> > > - snprintf(escaped, sizeof(escaped), "%*pEn", essid_len, essid);
> > > + snprintf(escaped, sizeof(escaped), "%*pE", essid_len, essid);
>
> > > - snprintf(escaped, sizeof(escaped), "%*pEn", essid_len, essid);
> > > + snprintf(escaped, sizeof(escaped), "%*pE", essid_len, essid);
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
--
Kees Cook
Powered by blists - more mailing lists