summaryrefslogtreecommitdiffstats
path: root/contrib/amd/fixmount/fixmount.c
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>1998-08-23 22:52:09 +0000
committerobrien <obrien@FreeBSD.org>1998-08-23 22:52:09 +0000
commit203b7d3a36b8e8be4852d4b82e69c57860efdfc3 (patch)
tree91aa7e9beeaea1d52c2661b5ab2d96dc3792d701 /contrib/amd/fixmount/fixmount.c
parente0e79339cc48dfca7ab913bdeecf17b24b4e4e21 (diff)
downloadFreeBSD-src-203b7d3a36b8e8be4852d4b82e69c57860efdfc3.zip
FreeBSD-src-203b7d3a36b8e8be4852d4b82e69c57860efdfc3.tar.gz
* Check getopt()'s return with -1, not EOF
* protect a few potential buffer overflows Obtained from: NetBSD
Diffstat (limited to 'contrib/amd/fixmount/fixmount.c')
-rw-r--r--contrib/amd/fixmount/fixmount.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/contrib/amd/fixmount/fixmount.c b/contrib/amd/fixmount/fixmount.c
index 9769a41..53c7807 100644
--- a/contrib/amd/fixmount/fixmount.c
+++ b/contrib/amd/fixmount/fixmount.c
@@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
- * $Id: fixmount.c,v 5.2.2.2 1992/05/31 16:35:45 jsp Exp $
+ * $Id: fixmount.c,v 1.1.1.1 1998/08/23 22:07:20 obrien Exp $
*
*/
@@ -68,7 +68,7 @@ extern int fixmount_check_mount(char *host, struct in_addr hostaddr, char *path)
static char dir_path[NFS_MAXPATHLEN];
static char localhost[] = "localhost";
-static char thishost[MAXHOSTNAMELEN] = "";
+static char thishost[MAXHOSTNAMELEN + 1] = "";
static exports mntexports;
static int quiet = 0;
static int type = 0;
@@ -288,7 +288,7 @@ main(int argc, char *argv[])
register int rpcs = 0;
struct timeval tv;
- while ((ch = getopt(argc, argv, "adervAqfh:")) != EOF)
+ while ((ch = getopt(argc, argv, "adervAqfh:")) != -1)
switch ((char) ch) {
case 'a':
@@ -354,6 +354,7 @@ main(int argc, char *argv[])
perror("gethostname");
exit(1);
}
+ thishost[sizeof(thishost) - 1] = '\0';
/*
* We need the hostname as it appears to the other side's
OpenPOWER on IntegriCloud