svn commit: r200421 - head/lib/libulog

Ed Schouten ed at FreeBSD.org
Fri Dec 11 15:52:42 PST 2009


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);


More information about the svn-src-head mailing list