lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdXxDPDQVwx_9Z6ngvs4sYro3cobE=YP0y-b0zs0ody2vg@mail.gmail.com>
Date: Wed, 14 May 2025 09:10:17 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Siddarth Gundu <siddarthsgml@...il.com>
Cc: linux-m68k@...ts.linux-m68k.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] m68k: apollo: replace strcpy() with strscpy()

Hi Siddarth,

Thanks for your patch!

On Wed, 14 May 2025 at 07:23, Siddarth Gundu <siddarthsgml@...il.com> wrote:
> strcpy() is deprecated; use strscpy() instead.
>
> strscpy was chosen because the code expects a NUL-terminated string
> without zero-padding.

... which are not sufficient reasons: there is no size information
about the destination buffer.

> Link: https://github.com/KSPP/linux/issues/88
> Signed-off-by: Siddarth Gundu <siddarthsgml@...il.com>

> --- a/arch/m68k/apollo/config.c
> +++ b/arch/m68k/apollo/config.c
> @@ -218,7 +219,7 @@ static void dn_dummy_reset(void)
>
>  static void dn_get_model(char *model)
>  {
> -    strcpy(model, "Apollo ");
> +    strscpy(model, "Apollo ");

include/linux/compiler.h:197:62: error: static assertion failed: "must be array"
[...]
arch/m68k/apollo/config.c:222:5: note: in expansion of macro ‘strscpy’
  222 |     strscpy(model, "Apollo ");
      |     ^~~~~~~

Please try to (at least) test-compile your patches before submitting.

>      if (apollo_model >= APOLLO_DN3000 && apollo_model <= APOLLO_DN4500)
>          strcat(model, apollo_models[apollo_model - APOLLO_DN3000]);

FWIW, if the strscpy() would have prevented a buffer overflow, the
strcat() would still cause one.  But none of these can happen for real.
>  }

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ