summaryrefslogtreecommitdiffstats
path: root/hunt/huntd/get_names.c
diff options
context:
space:
mode:
Diffstat (limited to 'hunt/huntd/get_names.c')
-rw-r--r--hunt/huntd/get_names.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/hunt/huntd/get_names.c b/hunt/huntd/get_names.c
index 2d1cbe4d..3e358e4f 100644
--- a/hunt/huntd/get_names.c
+++ b/hunt/huntd/get_names.c
@@ -1,4 +1,4 @@
-/* $NetBSD: get_names.c,v 1.2 1997/10/10 16:33:35 lukem Exp $ */
+/* $NetBSD: get_names.c,v 1.3 1998/07/06 07:00:31 mrg Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
@@ -7,7 +7,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: get_names.c,v 1.2 1997/10/10 16:33:35 lukem Exp $");
+__RCSID("$NetBSD: get_names.c,v 1.3 1998/07/06 07:00:31 mrg Exp $");
#endif /* not lint */
#include "bsd.h"
@@ -24,7 +24,7 @@ __RCSID("$NetBSD: get_names.c,v 1.2 1997/10/10 16:33:35 lukem Exp $");
extern CTL_MSG msg;
-static char hostname[MAXHOSTNAMELEN];
+static char hostname[MAXHOSTNAMELEN + 1];
char *my_machine_name;
/*
@@ -52,7 +52,8 @@ get_local_name(my_name)
msg.ctl_addr.sin_family = htons(AF_INET);
# endif
- (void) gethostname(hostname, sizeof (hostname));
+ (void)gethostname(hostname, sizeof (hostname));
+ hostname[sizeof(hostname) - 1] = '\0';
my_machine_name = hostname;
/* look up the address of the local host */
hp = gethostbyname(my_machine_name);