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]
Date:   Fri, 2 Aug 2019 07:38:58 -0600
From:   Jonathan Corbet <corbet@....net>
To:     Chuhong Yuan <hslester96@...il.com>
Cc:     Andy Whitcroft <apw@...onical.com>, Joe Perches <joe@...ches.com>,
        linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Documentation/checkpatch: Prefer str_has_prefix over
 strncmp

On Fri,  2 Aug 2019 14:25:37 +0800
Chuhong Yuan <hslester96@...il.com> wrote:

> Add strncmp() to Documentation/process/deprecated.rst since
> using strncmp() to check whether a string starts with a
> prefix is error-prone.
> The safe replacement is str_has_prefix().

Is that the *only* use of strncmp()?

> Also add check to the newly introduced deprecated_string_apis
> in checkpatch.pl.
> 
> This patch depends on patch:
> "Documentation/checkpatch: Prefer stracpy/strscpy over
> strcpy/strlcpy/strncpy."
> 
> Signed-off-by: Chuhong Yuan <hslester96@...il.com>
> ---
>  Documentation/process/deprecated.rst | 8 ++++++++
>  scripts/checkpatch.pl                | 1 +
>  2 files changed, 9 insertions(+)
> 
> diff --git a/Documentation/process/deprecated.rst b/Documentation/process/deprecated.rst
> index 56280e108d5a..22d3f0dbcf61 100644
> --- a/Documentation/process/deprecated.rst
> +++ b/Documentation/process/deprecated.rst
> @@ -109,6 +109,14 @@ the given limit of bytes to copy. This is inefficient and can lead to
>  linear read overflows if a source string is not NUL-terminated. The
>  safe replacement is stracpy() or strscpy().
>  
> +strncmp()
> +---------
> +:c:func:`strncmp` is often used to test if a string starts with a prefix

Please don't use :c:func: anymore; just say strncmp() and the right things
will happen.

Thanks,

jon

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ