Re: [PATCH v2] net: don't call strlen on non-terminated string in dev_set_alias()

2017-05-31 Thread Stephen Hemminger
On Wed, 31 May 2017 14:51:50 +0200 Alexander Potapenko wrote: > + /* alias comes from the userspace and may not be zero-terminated. > + */ > + memcpy(dev->ifalias, alias, len); You don't need a multi-line comment here.

[PATCH v2] net: don't call strlen on non-terminated string in dev_set_alias()

2017-05-31 Thread Alexander Potapenko
KMSAN reported a use of uninitialized memory in dev_set_alias(), which was caused by calling strlcpy() (which in turn called strlen()) on the user-supplied non-terminated string. Signed-off-by: Alexander Potapenko --- v2: fixed an off-by-one error spotted by Dmitry Vyukov For the record, here is