From 2ff3551a477fcad307baf808991472954ca0edc6 Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Wed, 6 Dec 2017 17:50:10 +0000 Subject: [PATCH] Fix crash with a dotless hostname. --- usr.bin/logger/logger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/logger/logger.c b/usr.bin/logger/logger.c index f88ad1ee8cf..71cc5fbb7aa 100644 --- a/usr.bin/logger/logger.c +++ b/usr.bin/logger/logger.c @@ -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 */