Date: Tue, 5 Dec 2017 20:40:51 -0800 From: Gleb Smirnoff <glebius@FreeBSD.org> To: Cy Schubert <Cy.Schubert@komquats.com> Cc: 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: <20171206044051.GF1056@FreeBSD.org> In-Reply-To: <201712060430.vB64U74f068870@slippy.cwsent.com> References: <glebius@FreeBSD.org> <201712051955.vB5Jtrwp079953@repo.freebsd.org> <201712060430.vB64U74f068870@slippy.cwsent.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
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):4629
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
[-- Attachment #2 --]
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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20171206044051.GF1056>
