Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Dec 2009 23:52:42 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r200421 - head/lib/libulog
Message-ID:  <200912112352.nBBNqgR2024161@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ed
Date: Fri Dec 11 23:52:42 2009
New Revision: 200421
URL: http://svn.freebsd.org/changeset/base/200421

Log:
  The hostname passed to ulog_login(3) may be optional.
  
  Don't trip on a null pointer being passed to this function when
  performing a local login.
  
  Noticed by:	dougb

Modified:
  head/lib/libulog/ulog_login.c

Modified: head/lib/libulog/ulog_login.c
==============================================================================
--- head/lib/libulog/ulog_login.c	Fri Dec 11 23:35:38 2009	(r200420)
+++ head/lib/libulog/ulog_login.c	Fri Dec 11 23:52:42 2009	(r200421)
@@ -48,7 +48,8 @@ ulog_login(const char *line, const char 
 	utx.ut_type = USER_PROCESS;
 	strncpy(utx.ut_line, line, sizeof utx.ut_line);
 	strncpy(utx.ut_user, user, sizeof utx.ut_user);
-	strncpy(utx.ut_host, host, sizeof utx.ut_host);
+	if (host != NULL)
+		strncpy(utx.ut_host, host, sizeof utx.ut_host);
 	gettimeofday(&utx.ut_tv, NULL);
 
 	ulog_pututxline(&utx);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912112352.nBBNqgR2024161>