summaryrefslogtreecommitdiffstats
path: root/contrib/amd/mk-amd-map
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/mk-amd-map
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/mk-amd-map')
-rw-r--r--contrib/amd/mk-amd-map/mk-amd-map.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/contrib/amd/mk-amd-map/mk-amd-map.c b/contrib/amd/mk-amd-map/mk-amd-map.c
index 2b41540..3eba7b2 100644
--- a/contrib/amd/mk-amd-map/mk-amd-map.c
+++ b/contrib/amd/mk-amd-map/mk-amd-map.c
@@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
- * $Id: mk-amd-map.c,v 5.2.2.1 1992/02/09 15:09:18 jsp beta $
+ * $Id: mk-amd-map.c,v 1.1.1.1 1998/08/23 22:07:21 obrien Exp $
*/
/*
@@ -229,7 +229,7 @@ main(int argc, char *argv[])
extern int optind;
/* test options */
- while ((ch = getopt(argc, argv, "p")) != EOF)
+ while ((ch = getopt(argc, argv, "p")) != -1)
switch (ch) {
case 'p':
printit = 1;
@@ -301,6 +301,7 @@ main(int argc, char *argv[])
int error = read_file(mapf, map, mapd);
(void) close(mapfd);
(void) fclose(mapf);
+ dbm_close(mapd);
if (printit) {
if (error) {
fprintf(stderr, "Error creating ndbm map for %s\n", map);
OpenPOWER on IntegriCloud