[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vet-vTz_Ld=Lturmm8NSpK1etvoj-7Wzn4-h=bM2FQgZg@mail.gmail.com>
Date: Sat, 30 Jun 2018 00:47:15 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: YueHaibing <yuehaibing@...wei.com>
Cc: simon@...kelleys.org.uk, Kalle Valo <kvalo@...eaurora.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
netdev <netdev@...r.kernel.org>,
"open list:TI WILINK WIRELES..." <linux-wireless@...r.kernel.org>,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH] atmel: using strlcpy() to avoid possible buffer overflows
On Fri, Jun 29, 2018 at 5:51 AM, YueHaibing <yuehaibing@...wei.com> wrote:
> 'firmware' is a module param which may been longer than firmware_id,
> so using strlcpy() to guard against overflows
strncat() is against overflow, this does a bit more.
> priv->firmware_id[0] = '\0';
...
> if (firmware) /* module parameter */
> - strcpy(priv->firmware_id, firmware);
> + strlcpy(priv->firmware_id, firmware, sizeof(priv->firmware_id));
In either case the above '\0' is not needed.
But it looks like the intention was to use strncat() / strlcat().
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists