aboutsummaryrefslogtreecommitdiff
path: root/contrib/amd/amd/amd.c
diff options
context:
space:
mode:
authorDavid E. O'Brien <obrien@FreeBSD.org>1998-08-23 22:52:09 +0000
committerDavid E. O'Brien <obrien@FreeBSD.org>1998-08-23 22:52:09 +0000
commit274bbe3187aa89b166eae8ab17f48d25438cb818 (patch)
tree4562786f7101b8fb46e77bbec0867074fcadef18 /contrib/amd/amd/amd.c
parentaad735d675a6e8bb77d3806b6aa34ef384a02b0e (diff)
downloadsrc-274bbe3187aa89b166eae8ab17f48d25438cb818.tar.gz
src-274bbe3187aa89b166eae8ab17f48d25438cb818.zip
* Check getopt()'s return with -1, not EOF
* protect a few potential buffer overflows Obtained from: NetBSD
Notes
Notes: svn path=/head/; revision=38500
Diffstat (limited to 'contrib/amd/amd/amd.c')
-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 7ef2ce7ed69d..3740529f0c99 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