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
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 */
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to