Re: [PATCH 1/9] rtl8192*: display ESSIDs using %pE
From: Kees Cook
Date: Thu Sep 05 2019 - 16:53:48 EST
On Thu, Sep 05, 2019 at 03:44:25PM -0400, J. Bruce Fields wrote:
> From: "J. Bruce Fields" <bfields@xxxxxxxxxx>
>
> 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.
Regardless:
Acked-by: Kees Cook <keescook@xxxxxxxxxxxx>
-Kees
>
> Signed-off-by: J. Bruce Fields <bfields@xxxxxxxxxx>
> ---
> drivers/staging/rtl8192e/rtllib.h | 2 +-
> drivers/staging/rtl8192u/ieee80211/ieee80211.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
> index 2dd57e88276e..096254e422b3 100644
> --- a/drivers/staging/rtl8192e/rtllib.h
> +++ b/drivers/staging/rtl8192e/rtllib.h
> @@ -2132,7 +2132,7 @@ static inline const char *escape_essid(const char *essid, u8 essid_len)
> return escaped;
> }
>
> - snprintf(escaped, sizeof(escaped), "%*pEn", essid_len, essid);
> + snprintf(escaped, sizeof(escaped), "%*pE", essid_len, essid);
> return escaped;
> }
>
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
> index d36963469015..3963a08b9eb2 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
> @@ -2426,7 +2426,7 @@ static inline const char *escape_essid(const char *essid, u8 essid_len)
> return escaped;
> }
>
> - snprintf(escaped, sizeof(escaped), "%*pEn", essid_len, essid);
> + snprintf(escaped, sizeof(escaped), "%*pE", essid_len, essid);
> return escaped;
> }
>
> --
> 2.21.0
>
--
Kees Cook