From c6c6c7de65eae103002ebb9bee8881e1e2e903df Mon Sep 17 00:00:00 2001 From: brian Date: Wed, 7 Apr 1999 08:27:45 +0000 Subject: 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 --- libexec/rexecd/rexecd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libexec/rexecd') diff --git a/libexec/rexecd/rexecd.c b/libexec/rexecd/rexecd.c index 740368f..8c8c06b 100644 --- a/libexec/rexecd/rexecd.c +++ b/libexec/rexecd/rexecd.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)rexecd.c 8.1 (Berkeley) 6/4/93"; #endif static const char rcsid[] = - "$Id: rexecd.c,v 1.15 1997/11/26 07:29:04 charnier Exp $"; + "$Id: rexecd.c,v 1.16 1999/04/06 23:05:57 brian Exp $"; #endif /* not lint */ #include @@ -73,7 +73,7 @@ char path[sizeof(_PATH_DEFPATH) + sizeof("PATH=")] = "PATH="; char *envinit[] = {homedir, shell, path, username, 0}; char **environ; -char remote[MAXHOSTNAMELEN + 1]; +char remote[MAXHOSTNAMELEN]; struct sockaddr_in asin = { AF_INET }; @@ -104,7 +104,7 @@ main(argc, argv) if (getpeername(0, (struct sockaddr *)&from, &fromlen) < 0) err(1, "getpeername"); - realhostname(remote, sizeof remote - 1, &from.sin_addr); + realhostname(remote, sizeof(remote) - 1, &from.sin_addr); doit(0, &from); return(0); -- cgit v1.1