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: <CAH7mPvh_T1YzfGBR+mzcwQ5r6bhz2NxrvY5r7sSY=wMeh-GK+w@mail.gmail.com>
Date:   Tue, 29 May 2018 18:55:23 -0700
From:   Nick Desaulniers <nick.desaulniers@...il.com>
To:     "Steven Rostedt (VMware)" <rostedt@...dmis.org>,
        Ingo Molnar <mingo@...hat.com>
Cc:     Nick Desaulniers <nick.desaulniers@...il.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        ebiggers@...gle.com
Subject: Re: [PATCH] tracing: prefer strlcpy to strncpy

On Mon, May 28, 2018 at 11:03 PM, Nick Desaulniers
<nick.desaulniers@...il.com> wrote:
> Fixes a stringop-truncation warning from gcc-8.
>
> Signed-off-by: Nick Desaulniers <nick.desaulniers@...il.com>
> ---
>  kernel/trace/trace_events_hist.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
> index b9061ed..b53a6c0 100644
> --- a/kernel/trace/trace_events_hist.c
> +++ b/kernel/trace/trace_events_hist.c
> @@ -393,7 +393,7 @@ static void hist_err_event(char *str, char *system, char *event, char *var)
>         else if (system)
>                 snprintf(err, MAX_FILTER_STR_VAL, "%s.%s", system, event);
>         else
> -               strncpy(err, var, MAX_FILTER_STR_VAL);
> +               strlcpy(err, var, MAX_FILTER_STR_VAL);
>
>         hist_err(str, err);
>  }
> --
> 2.7.4
>

Eric points out this wont initialize the rest of err with zeros.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ