summaryrefslogtreecommitdiffstats
path: root/contrib/amd/amd
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/amd
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/amd')
-rw-r--r--contrib/amd/amd/amd.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/contrib/amd/amd/amd.c b/contrib/amd/amd/amd.c
index 7ef2ce7..3740529 100644
--- a/contrib/amd/amd/amd.c
+++ b/contrib/amd/amd/amd.c
@@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
- * $Id: amd.c,v 5.2.2.1 1992/02/09 15:08:15 jsp beta $
+ * $Id: amd.c,v 1.1.1.1 1998/08/23 22:07:20 obrien Exp $
*
*/
@@ -57,8 +57,8 @@ struct amu_global_options gopt; /* where global options are stored */
char pid_fsname[16 + MAXHOSTNAMELEN]; /* "kiska.southseas.nz:(pid%d)" */
char *progname; /* "amd" */
char *hostdomain = "unknown.domain";
-char hostname[MAXHOSTNAMELEN] = "localhost"; /* Hostname */
-char hostd[2 * MAXHOSTNAMELEN]; /* Host+domain */
+char hostname[MAXHOSTNAMELEN + 1] = "localhost"; /* Hostname */
+char hostd[2 * MAXHOSTNAMELEN + 1]; /* Host+domain */
char *endian = ARCH_ENDIAN; /* Big or Little endian */
char *cpu = HOST_CPU; /* CPU type */
char *PrimNetName; /* name of primary network */
@@ -349,6 +349,7 @@ main(int argc, char *argv[])
plog(XLOG_FATAL, "gethostname: %m");
going_down(1);
}
+ hostname[sizeof(hostname) - 1] = '\0';
/*
* Check it makes sense
OpenPOWER on IntegriCloud