diff options
author | brian <brian@FreeBSD.org> | 1999-04-07 08:27:45 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1999-04-07 08:27:45 +0000 |
commit | c6c6c7de65eae103002ebb9bee8881e1e2e903df (patch) | |
tree | 18fb09ba4ed57096b2a23fd9d28689784a00024b /libexec/rbootd/rbootd.c | |
parent | 32ff8071a15df941cbe4d98c0badea284464f320 (diff) | |
download | FreeBSD-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/rbootd/rbootd.c')
-rw-r--r-- | libexec/rbootd/rbootd.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libexec/rbootd/rbootd.c b/libexec/rbootd/rbootd.c index a74734c..b8e384d 100644 --- a/libexec/rbootd/rbootd.c +++ b/libexec/rbootd/rbootd.c @@ -55,7 +55,7 @@ static const char copyright[] = static const char sccsid[] = "@(#)rbootd.c 8.1 (Berkeley) 6/4/93"; #endif static const char rcsid[] = - "$Id$"; + "$Id: rbootd.c,v 1.9 1997/11/24 07:33:41 charnier Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -168,11 +168,11 @@ main(argc, argv) /* * Grab our host name and pid. */ - if (gethostname(MyHost, MAXHOSTNAMELEN) < 0) { + if (gethostname(MyHost, MAXHOSTNAMELEN - 1) < 0) { syslog(LOG_ERR, "gethostname: %m"); Exit(0); } - MyHost[MAXHOSTNAMELEN] = '\0'; + MyHost[MAXHOSTNAMELEN - 1] = '\0'; MyPid = getpid(); |