summaryrefslogtreecommitdiffstats
path: root/lib/libulog
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-12-11 23:52:42 +0000
committered <ed@FreeBSD.org>2009-12-11 23:52:42 +0000
commitae165eac2a3908031533072cbfd8bbede8a91a69 (patch)
tree7efc5b331172c8276b45b714e7ff195b865882b9 /lib/libulog
parentb963db4652a0bf1718825e8e1a9bc93e87b7a80f (diff)
downloadFreeBSD-src-ae165eac2a3908031533072cbfd8bbede8a91a69.zip
FreeBSD-src-ae165eac2a3908031533072cbfd8bbede8a91a69.tar.gz
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
Diffstat (limited to 'lib/libulog')
-rw-r--r--lib/libulog/ulog_login.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libulog/ulog_login.c b/lib/libulog/ulog_login.c
index a788a9df..15d607e 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);
OpenPOWER on IntegriCloud