Re: [PATCH] Revert "HID: uhid: use strlcpy() instead of strncpy()"

2018-11-19 Thread Jiri Kosina
On Wed, 14 Nov 2018, David Herrmann wrote: > This reverts commit 336fd4f5f25157e9e8bd50e898a1bbcd99eaea46. > > Please note that `strlcpy()` does *NOT* do what you think it does. > strlcpy() *ALWAYS* reads the full input string, regardless of the > 'length' parameter. That is, if the input is not

Re: [PATCH] Revert "HID: uhid: use strlcpy() instead of strncpy()"

2018-11-19 Thread Jiri Kosina
On Wed, 14 Nov 2018, David Herrmann wrote: > This reverts commit 336fd4f5f25157e9e8bd50e898a1bbcd99eaea46. > > Please note that `strlcpy()` does *NOT* do what you think it does. > strlcpy() *ALWAYS* reads the full input string, regardless of the > 'length' parameter. That is, if the input is not

Re: [PATCH] Revert "HID: uhid: use strlcpy() instead of strncpy()"

2018-11-15 Thread Kees Cook
On Thu, Nov 15, 2018 at 5:55 AM, David Herrmann wrote: > Hi > > On Thu, Nov 15, 2018 at 12:09 AM Kees Cook wrote: >> On Wed, Nov 14, 2018 at 9:40 AM, Laura Abbott wrote: > [...] >> > Can we switch to strscpy instead? This will quiet gcc and avoid the >> > issues with strlcpy. >> >> Yes please:

Re: [PATCH] Revert "HID: uhid: use strlcpy() instead of strncpy()"

2018-11-15 Thread Kees Cook
On Thu, Nov 15, 2018 at 5:55 AM, David Herrmann wrote: > Hi > > On Thu, Nov 15, 2018 at 12:09 AM Kees Cook wrote: >> On Wed, Nov 14, 2018 at 9:40 AM, Laura Abbott wrote: > [...] >> > Can we switch to strscpy instead? This will quiet gcc and avoid the >> > issues with strlcpy. >> >> Yes please:

Re: [PATCH] Revert "HID: uhid: use strlcpy() instead of strncpy()"

2018-11-15 Thread David Herrmann
Hi On Thu, Nov 15, 2018 at 12:09 AM Kees Cook wrote: > On Wed, Nov 14, 2018 at 9:40 AM, Laura Abbott wrote: [...] > > Can we switch to strscpy instead? This will quiet gcc and avoid the > > issues with strlcpy. > > Yes please: it looks like these strings are expected to be NUL > terminated, so

Re: [PATCH] Revert "HID: uhid: use strlcpy() instead of strncpy()"

2018-11-15 Thread David Herrmann
Hi On Thu, Nov 15, 2018 at 12:09 AM Kees Cook wrote: > On Wed, Nov 14, 2018 at 9:40 AM, Laura Abbott wrote: [...] > > Can we switch to strscpy instead? This will quiet gcc and avoid the > > issues with strlcpy. > > Yes please: it looks like these strings are expected to be NUL > terminated, so

Re: [PATCH] Revert "HID: uhid: use strlcpy() instead of strncpy()"

2018-11-14 Thread Kees Cook
On Wed, Nov 14, 2018 at 9:40 AM, Laura Abbott wrote: > On 11/14/18 5:16 AM, David Herrmann wrote: >> >> This reverts commit 336fd4f5f25157e9e8bd50e898a1bbcd99eaea46. >> >> Please note that `strlcpy()` does *NOT* do what you think it does. >> strlcpy() *ALWAYS* reads the full input string,

Re: [PATCH] Revert "HID: uhid: use strlcpy() instead of strncpy()"

2018-11-14 Thread Kees Cook
On Wed, Nov 14, 2018 at 9:40 AM, Laura Abbott wrote: > On 11/14/18 5:16 AM, David Herrmann wrote: >> >> This reverts commit 336fd4f5f25157e9e8bd50e898a1bbcd99eaea46. >> >> Please note that `strlcpy()` does *NOT* do what you think it does. >> strlcpy() *ALWAYS* reads the full input string,

Re: [PATCH] Revert "HID: uhid: use strlcpy() instead of strncpy()"

2018-11-14 Thread Laura Abbott
On 11/14/18 5:16 AM, David Herrmann wrote: This reverts commit 336fd4f5f25157e9e8bd50e898a1bbcd99eaea46. Please note that `strlcpy()` does *NOT* do what you think it does. strlcpy() *ALWAYS* reads the full input string, regardless of the 'length' parameter. That is, if the input is not

Re: [PATCH] Revert "HID: uhid: use strlcpy() instead of strncpy()"

2018-11-14 Thread Laura Abbott
On 11/14/18 5:16 AM, David Herrmann wrote: This reverts commit 336fd4f5f25157e9e8bd50e898a1bbcd99eaea46. Please note that `strlcpy()` does *NOT* do what you think it does. strlcpy() *ALWAYS* reads the full input string, regardless of the 'length' parameter. That is, if the input is not

[PATCH] Revert "HID: uhid: use strlcpy() instead of strncpy()"

2018-11-14 Thread David Herrmann
This reverts commit 336fd4f5f25157e9e8bd50e898a1bbcd99eaea46. Please note that `strlcpy()` does *NOT* do what you think it does. strlcpy() *ALWAYS* reads the full input string, regardless of the 'length' parameter. That is, if the input is not zero-terminated, strlcpy() will *READ* beyond input

[PATCH] Revert "HID: uhid: use strlcpy() instead of strncpy()"

2018-11-14 Thread David Herrmann
This reverts commit 336fd4f5f25157e9e8bd50e898a1bbcd99eaea46. Please note that `strlcpy()` does *NOT* do what you think it does. strlcpy() *ALWAYS* reads the full input string, regardless of the 'length' parameter. That is, if the input is not zero-terminated, strlcpy() will *READ* beyond input