summaryrefslogtreecommitdiffstats
path: root/libexec/getty
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1999-04-07 08:27:45 +0000
committerbrian <brian@FreeBSD.org>1999-04-07 08:27:45 +0000
commitc6c6c7de65eae103002ebb9bee8881e1e2e903df (patch)
tree18fb09ba4ed57096b2a23fd9d28689784a00024b /libexec/getty
parent32ff8071a15df941cbe4d98c0badea284464f320 (diff)
downloadFreeBSD-src-c6c6c7de65eae103002ebb9bee8881e1e2e903df.zip
FreeBSD-src-c6c6c7de65eae103002ebb9bee8881e1e2e903df.tar.gz
Ensure that things returned by gethostname() and
friends are terminated and allow for a maximum host name length of MAXHOSTNAMELEN - 1. Put parenthesis around sizeof args. Make some variables static. Fix telnetd -u (broken by my last commit) Prompted by: bde
Diffstat (limited to 'libexec/getty')
-rw-r--r--libexec/getty/main.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libexec/getty/main.c b/libexec/getty/main.c
index 0047f59..cf1bf29 100644
--- a/libexec/getty/main.c
+++ b/libexec/getty/main.c
@@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)from: main.c 8.1 (Berkeley) 6/20/93";
#endif
static const char rcsid[] =
- "$Id: main.c,v 1.24 1999/03/09 22:04:44 brian Exp $";
+ "$Id: main.c,v 1.25 1999/04/04 04:36:50 peter Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -194,7 +194,8 @@ main(argc, argv)
signal(SIGQUIT, SIG_IGN);
openlog("getty", LOG_ODELAY|LOG_CONS|LOG_PID, LOG_AUTH);
- gethostname(hostname, sizeof(hostname));
+ gethostname(hostname, sizeof(hostname) - 1);
+ hostname[sizeof(hostname) - 1] = '\0';
if (hostname[0] == '\0')
strcpy(hostname, "Amnesiac");
OpenPOWER on IntegriCloud