Re: [PATCH v2] vt: Replace strlcpy with strscpy

2023-09-20 Thread Kees Cook
On Tue, Sep 19, 2023 at 07:21:56PM +, Azeem Shaikh wrote: > strlcpy() reads the entire source buffer first and returns the size of > the source string, not the destination string, which can be accidentally > misused [1]. > > The copy_to_user() call uses @len returned from strlcpy() directly >

Re: [PATCH v2] vt: Replace strlcpy with strscpy

2023-09-19 Thread Justin Stitt
On Tue, Sep 19, 2023 at 12:22 PM Azeem Shaikh wrote: > > strlcpy() reads the entire source buffer first and returns the size of > the source string, not the destination string, which can be accidentally > misused [1]. > > The copy_to_user() call uses @len returned from strlcpy() directly > without

[PATCH v2] vt: Replace strlcpy with strscpy

2023-09-19 Thread Azeem Shaikh
strlcpy() reads the entire source buffer first and returns the size of the source string, not the destination string, which can be accidentally misused [1]. The copy_to_user() call uses @len returned from strlcpy() directly without checking its value. This could potentially lead to read overflow.