Re: [PATCH v2] kdb: replace deprecated strncpy

2024-04-09 Thread Justin Stitt
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); > >

[PATCH v2] kdb: replace deprecated strncpy

2024-04-04 Thread Justin Stitt
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

Re: [PATCH v2] kdb: replace deprecated strncpy

2024-04-08 Thread Justin Stitt
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

[PATCH] kdb: replace deprecated strncpy

2024-04-02 Thread Justin Stitt
[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

Re: [Kgdb-bugreport] [PATCH v2 1/7] kdb: Fix buffer overflow during tab-complete

2024-04-22 Thread Justin Stitt via Kgdb-bugreport
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...

Re: [Kgdb-bugreport] [PATCH v2 0/7] kdb: Refactor and fix bugs in kdb_read()

2024-04-22 Thread Justin Stitt via Kgdb-bugreport
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 >

Re: [Kgdb-bugreport] [PATCH] kdb: replace deprecated strncpy

2024-04-03 Thread Justin Stitt via Kgdb-bugreport
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