summaryrefslogtreecommitdiffstats
path: root/libexec/rbootd/rbootd.c
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/rbootd/rbootd.c
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/rbootd/rbootd.c')
-rw-r--r--libexec/rbootd/rbootd.c6
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();
OpenPOWER on IntegriCloud