Date: Tue, 05 Dec 2017 20:58:55 -0800 From: Cy Schubert <Cy.Schubert@komquats.com> To: Gleb Smirnoff <glebius@FreeBSD.org> Cc: Cy Schubert <Cy.Schubert@komquats.com>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r326574 - head/usr.bin/logger Message-ID: <201712060458.vB64wtWS004930@slippy.cwsent.com> In-Reply-To: Message from Gleb Smirnoff <glebius@FreeBSD.org> of "Tue, 05 Dec 2017 20:40:51 -0800." <20171206044051.GF1056@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <20171206044051.GF1056@FreeBSD.org>, Gleb Smirnoff writes:
>
>
> --/NkBOFFp2J2Af1nK
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: inline
>
> Hi Cy,
>
> On Tue, Dec 05, 2017 at 08:30:07PM -0800, Cy Schubert wrote:
> C> Hi Gleb,
> C>
> C> I'm getting a segfault here.
> C>
> C> [New LWP 101396]
> C> Core was generated by `logger -p daemon.notice -t local-dhclient(lagg0):46
> 29
> C> 2 dhclient-script for inter'.
> C> Program terminated with signal SIGSEGV, Segmentation fault.
> C> #0 0x0000000000402152 in main (argc=<optimized out>, argv=<optimized out>
> )
> C> at /opt/src/svn-current/usr.bin/logger/logger.c:186
> C> 186 *strchr(hostname, '.') = '\0';
> C> (gdb) bt
> C> #0 0x0000000000402152 in main (argc=<optimized out>, argv=<optimized out>
> )
> C> at /opt/src/svn-current/usr.bin/logger/logger.c:186
> C> (gdb)
>
> Mea culpa! Can you please test the attached patch?
>
> --
> Gleb Smirnoff
>
> --/NkBOFFp2J2Af1nK
> Content-Type: text/x-diff; charset=us-ascii
> Content-Disposition: attachment; filename="logger.diff"
>
> Index: logger.c
> ===================================================================
> --- logger.c (revision 326614)
> +++ logger.c (working copy)
> @@ -183,7 +183,7 @@ main(int argc, char *argv[])
> if (hostname == NULL) {
> hostname = hbuf;
> (void )gethostname(hbuf, MAXHOSTNAMELEN);
> - *strchr(hostname, '.') = '\0';
> + *strchrnul(hostname, '.') = '\0';
> }
>
> /* log input line if appropriate */
>
> --/NkBOFFp2J2Af1nK--
Fixed. Thanks!
--
Cheers,
Cy Schubert <Cy.Schubert@cschubert.com>
FreeBSD UNIX: <cy@FreeBSD.org> Web: http://www.FreeBSD.org
The need of the many outweighs the greed of the few.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201712060458.vB64wtWS004930>
