From c4cd42053e4ce99e195418c2cfa8a521fc6fe295 Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Fri, 11 Dec 2009 23:52:42 +0000 Subject: [PATCH] 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 --- lib/libulog/ulog_login.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libulog/ulog_login.c b/lib/libulog/ulog_login.c index a788a9dfedb..15d607e088f 100644 --- a/lib/libulog/ulog_login.c +++ b/lib/libulog/ulog_login.c @@ -48,7 +48,8 @@ ulog_login(const char *line, const char *user, const char *host) 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);