diff options
author | Warner Losh <imp@FreeBSD.org> | 1997-12-24 00:58:39 +0000 |
---|---|---|
committer | Warner Losh <imp@FreeBSD.org> | 1997-12-24 00:58:39 +0000 |
commit | 164309e22e0aeb397cbfb7f98936e8d67f4179fc (patch) | |
tree | d467b763c30e57d213cf18aa6fad7227a8891e21 /sbin | |
parent | 9ae323c5f09087203dd9599a5e16cbe4cfceea69 (diff) | |
download | src-164309e22e0aeb397cbfb7f98936e8d67f4179fc.tar.gz src-164309e22e0aeb397cbfb7f98936e8d67f4179fc.zip |
Be extra paranoid about trusting the length returned by gethostbyaddr.
Submitted by: Julian Assange
Notes
Notes:
svn path=/head/; revision=31955
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/mount_nfs/mount_nfs.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sbin/mount_nfs/mount_nfs.c b/sbin/mount_nfs/mount_nfs.c index efe52a257329..246c40a7f6ba 100644 --- a/sbin/mount_nfs/mount_nfs.c +++ b/sbin/mount_nfs/mount_nfs.c @@ -45,7 +45,7 @@ static char copyright[] = static char sccsid[] = "@(#)mount_nfs.c 8.11 (Berkeley) 5/4/95"; */ static const char rcsid[] = - "$Id: mount_nfs.c,v 1.23 1997/06/03 13:49:26 dfr Exp $"; + "$Id: mount_nfs.c,v 1.24 1997/10/19 16:40:01 joerg Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -694,7 +694,7 @@ getnfsargs(spec, nfsargsp) return (0); } } else if ((hp = gethostbyname(hostp)) != NULL) - memmove(&saddr.sin_addr, hp->h_addr, hp->h_length); + memmove(&saddr.sin_addr, hp->h_addr, MIN(hp->h_length, sizeof(saddr.sin_addr))); else { warnx("can't get net id for host"); return (0); @@ -706,7 +706,7 @@ getnfsargs(spec, nfsargsp) warnx("can't reverse resolve net address"); return (0); } - memmove(&saddr.sin_addr, hp->h_addr, hp->h_length); + memmove(&saddr.sin_addr, hp->h_addr, MIN(hp->h_length, sizeof(saddr.sin_addr))); strncpy(inst, hp->h_name, INST_SZ); inst[INST_SZ - 1] = '\0'; if (cp = strchr(inst, '.')) |