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] [day] [month] [year] [list]
Message-ID: <CAAMvbhHvyiWKb9Pn9=JUuE_efWK2EMcy2SBP6p_BvLGCjwW_VA@mail.gmail.com>
Date:   Thu, 19 Oct 2023 19:13:38 +0100
From:   James Dutton <james.dutton@...il.com>
To:     Bagas Sanjaya <bagasdotme@...il.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Cc:     Justin Stitt <justinstitt@...gle.com>,
        Randy Dunlap <rdunlap@...radead.org>,
        Calvince Otieno <calvncce@...il.com>,
        Azeem Shaikh <azeemshaikh38@...il.com>,
        Kees Cook <keescook@...omium.org>,
        Andy Shevchenko <andy@...nel.org>
Subject: Re: Is strncpy really less secure than strscpy ?

On Thu, 19 Oct 2023 at 02:49, Bagas Sanjaya <bagasdotme@...il.com> wrote:
>
[snip]
>
> What if printf("a is  %.*s\n", a);?
Um, it fails to compile.
>
> >
> >
> > So, why isn't the printk format specifier "%.*s" used more instead of
> > "%s" in the kernel?
>
> Since basically strings are pointers.
Um, I was trying to draw people's attention to the fact that "%.*s" is
much safer than "%s".
"%s" is like strcpy() but for print statements.
"%.*s" is like strncpy() but for print statements.

Why wasn't "%.*s" also included in the string discussions previously?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ