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:   Sat, 10 Feb 2018 10:29:11 +0100
From:   Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To:     Robert Abel <rabel@...ertabel.eu>
Cc:     linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/3] auxdisplay: charlcd: use null character instead of
 zero literal to terminate strings

On Sat, Feb 10, 2018 at 12:50 AM, Robert Abel <rabel@...ertabel.eu> wrote:
> Using '\0' instead of plain 0 makes the intent clearer that this is indeed a string and not a series of integers.
>
> Signed-off-by: Robert Abel <rabel@...ertabel.eu>
> ---
>  drivers/auxdisplay/charlcd.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/auxdisplay/charlcd.c b/drivers/auxdisplay/charlcd.c
> index 324d02f9f1c5..92549c8344a4 100644
> --- a/drivers/auxdisplay/charlcd.c
> +++ b/drivers/auxdisplay/charlcd.c
> @@ -527,7 +527,7 @@ static void charlcd_write_char(struct charlcd *lcd, char c)
>         if ((c != '\n') && priv->esc_seq.len >= 0) {
>                 /* yes, let's add this char to the buffer */
>                 priv->esc_seq.buf[priv->esc_seq.len++] = c;
> -               priv->esc_seq.buf[priv->esc_seq.len] = 0;
> +               priv->esc_seq.buf[priv->esc_seq.len] = '\0';
>         } else {
>                 /* aborts any previous escape sequence */
>                 priv->esc_seq.len = -1;
> @@ -536,7 +536,7 @@ static void charlcd_write_char(struct charlcd *lcd, char c)
>                 case LCD_ESCAPE_CHAR:
>                         /* start of an escape sequence */
>                         priv->esc_seq.len = 0;
> -                       priv->esc_seq.buf[priv->esc_seq.len] = 0;
> +                       priv->esc_seq.buf[priv->esc_seq.len] = '\0';

Trivial. Compile-tested.

Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>

>                         break;
>                 case '\b':
>                         /* go back one char and clear it */
> --
> 2.11.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ