Hi,
On Tue, Apr 9, 2024 at 11:36 AM Daniel Thompson
wrote:
>
> On Mon, Apr 08, 2024 at 05:46:42PM -0700, Justin Stitt wrote:
> > On Fri, Apr 5, 2024 at 2:51 AM Daniel Thompson
> > wrote:
> > >
> > > > len_tmp = strlen(p_tmp);
> >
el.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings
[1]
Link: https://github.com/KSPP/linux/issues/90 [2]
Link: https://www.kernel.org/doc/html/v5.0/dev-tools/kgdb.html#using-kdb [3]
Cc: linux-harden...@vger.kernel.org
Signed-off-by: Justin Stitt
---
Changes in v2:
- u
On Fri, Apr 5, 2024 at 2:51 AM Daniel Thompson
wrote:
>
> > len_tmp = strlen(p_tmp);
> > - strncpy(cp, p_tmp+len, len_tmp-len + 1);
> > + strscpy(cp, p_tmp+len, len_tmp-len + 1);
>
> Again, I really don't think the third argument
[1] and we want to remove all its uses [2].
Link:
https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings
[1]
Link: https://github.com/KSPP/linux/issues/90 [2]
Cc: linux-harden...@vger.kernel.org
Signed-off-by: Justin Stitt
---
Note: build-tested only
the dubious strncpy() calls with memmove()/memcpy()
> calls plus explicit boundary checks to make sure we have enough space
> before we start moving characters around.
>
> Reported-by: Justin Stitt
> Closes:
> https://lore.kernel.org/all/cafhgd8qesuuifuhsnjfpr-va3p80bxrw+lqvc8dea8gziuj...
Hi,
On Mon, Apr 22, 2024 at 05:35:53PM +0100, Daniel Thompson wrote:
> Inspired by a patch from [Justin][1] I took a closer look at kdb_read().
>
> Despite Justin's patch being a (correct) one-line manipulation it was a
> tough patch to review because the surrounding code was hard to read and
>
On Wed, Apr 3, 2024 at 4:23 AM Daniel Thompson
wrote:
> > - strncpy(cp, p_tmp+len, len_tmp-len + 1);
> > + memcpy(cp, p_tmp+len, len_tmp-len + 1);
>
> Roughly the same question here. The original coded is obviously wrong
> so trusting it did the boundary