summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorHajimu UMEMOTO <ume@FreeBSD.org>2000-07-20 18:56:10 +0000
committerHajimu UMEMOTO <ume@FreeBSD.org>2000-07-20 18:56:10 +0000
commita7a1fe81d681e61d33c1f38fc19335c5399eaa60 (patch)
treead06e95f8e27da8b3781e5341824c40d2c0314f4 /lib/libc
parente3009dc890c0f8e46f011ac46c2e87ce56f24294 (diff)
Notes
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/net/rcmd.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/libc/net/rcmd.c b/lib/libc/net/rcmd.c
index 70a18d449f3f..1c77f00d3eb8 100644
--- a/lib/libc/net/rcmd.c
+++ b/lib/libc/net/rcmd.c
@@ -58,6 +58,7 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94";
#include <rpcsvc/yp_prot.h>
#include <rpcsvc/ypclnt.h>
#endif
+#include <arpa/nameser.h>
/* wrapper for KAME-special getnameinfo() */
#ifndef NI_WITHSCOPEID
@@ -101,6 +102,7 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
char c;
int refused;
char num[8];
+ static char canonnamebuf[MAXDNAME]; /* is it proper here? */
pid = getpid();
@@ -119,8 +121,12 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
strerror(errno));
return (-1);
}
- if (res->ai_canonname)
- *ahost = res->ai_canonname;
+
+ if (res->ai_canonname
+ && strlen(res->ai_canonname) + 1 < sizeof(canonnamebuf)) {
+ strncpy(canonnamebuf, res->ai_canonname, sizeof(canonnamebuf));
+ *ahost = canonnamebuf;
+ }
ai = res;
refused = 0;
oldmask = sigblock(sigmask(SIGURG));