Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Jan 2018 23:20:57 +0100
From:      Ed Schouten <ed@nuxi.nl>
To:        "Pedro F. Giffuni" <pfg@freebsd.org>
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r328492 - head/contrib/opie/libopie
Message-ID:  <CABh_MKn=3pRWyMHUAQkG17dQVBFEwFA2esFixPtgkCt7VE5oCw@mail.gmail.com>
In-Reply-To: <201801272216.w0RMGJwo057492@repo.freebsd.org>
References:  <201801272216.w0RMGJwo057492@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi Pedro,

2018-01-27 23:16 GMT+01:00 Pedro F. Giffuni <pfg@freebsd.org>:
>         char host[sizeof(utmp.ut_host) + 1];
>         insecure = 1;
>
> -       strncpy(host, utmp.ut_host, sizeof(utmp.ut_host));
> -       host[sizeof(utmp.ut_host)] = 0;
> +       strncpy(host, utmp.ut_host, sizeof(host));

Wait... This may access utmp.ut_host one byte past the end and no
longer guarantees that host is null-terminated, right?

-- 
Ed Schouten <ed@nuxi.nl>
Nuxi, 's-Hertogenbosch, the Netherlands



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CABh_MKn=3pRWyMHUAQkG17dQVBFEwFA2esFixPtgkCt7VE5oCw>