summaryrefslogtreecommitdiff
path: root/usr.bin/rpcinfo/rpcinfo.c
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>1998-06-09 04:31:02 +0000
committerWarner Losh <imp@FreeBSD.org>1998-06-09 04:31:02 +0000
commita716ad6693847224d462f50b79628fa78dafc859 (patch)
tree68c7880163e0a885103d61ee66ddea0faa64d288 /usr.bin/rpcinfo/rpcinfo.c
parentf34c49eb546e3858af3c081200cc81c5e8438b01 (diff)
downloadsrc-test2-a716ad6693847224d462f50b79628fa78dafc859.tar.gz
src-test2-a716ad6693847224d462f50b79628fa78dafc859.zip
Notes
Diffstat (limited to 'usr.bin/rpcinfo/rpcinfo.c')
-rw-r--r--usr.bin/rpcinfo/rpcinfo.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.bin/rpcinfo/rpcinfo.c b/usr.bin/rpcinfo/rpcinfo.c
index d5161d07485b..f6cae7162ddb 100644
--- a/usr.bin/rpcinfo/rpcinfo.c
+++ b/usr.bin/rpcinfo/rpcinfo.c
@@ -2,7 +2,7 @@
/*static char sccsid[] = "from: @(#)rpcinfo.c 1.22 87/08/12 SMI";*/
/*static char sccsid[] = "from: @(#)rpcinfo.c 2.2 88/08/11 4.0 RPCSRC";*/
static char rcsid[] =
- "$Id: rpcinfo.c,v 1.5 1997/03/29 04:31:57 imp Exp $";
+ "$Id: rpcinfo.c,v 1.6 1997/08/06 06:49:06 charnier Exp $";
#endif
/*
@@ -52,6 +52,8 @@ static char rcsid[] =
#include <rpc/pmap_prot.h>
#include <rpc/pmap_clnt.h>
#include <signal.h>
+#include <ctype.h>
+#include <sys/param.h>
#define MAXHOSTLEN 256
@@ -496,7 +498,7 @@ pmapdump(argc, argv)
server_addr.sin_family = AF_INET;
if ((hp = gethostbyname("localhost")) != NULL)
bcopy(hp->h_addr, (caddr_t)&server_addr.sin_addr,
- hp->h_length);
+ MIN(hp->h_length,sizeof(server_addr.sin_addr)));
else
server_addr.sin_addr.s_addr = inet_addr("0.0.0.0");
}
@@ -653,8 +655,9 @@ get_inet_address(addr, host)
addr->sin_addr.s_addr = (u_long) inet_addr(host);
if (addr->sin_addr.s_addr == -1 || addr->sin_addr.s_addr == 0) {
if ((hp = gethostbyname(host)) == NULL)
- errx(1, "%s is unknown host", host);
- bcopy(hp->h_addr, (char *)&addr->sin_addr, hp->h_length);
+ errx(1, "%s is unknown host\n", host);
+ bcopy(hp->h_addr, (char *)&addr->sin_addr,
+ MIN(hp->h_length,sizeof(addr->sin_addr)));
}
addr->sin_family = AF_INET;
}