changeset 179:6f890e61739b

fix...
author szabii
date Wed, 21 Mar 2001 02:56:06 +0000
parents 55206b791586
children afa2c05cfe43
files cfgparser.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/cfgparser.c	Wed Mar 21 00:14:42 2001 +0000
+++ b/cfgparser.c	Wed Mar 21 02:56:06 2001 +0000
@@ -228,8 +228,8 @@
 #define MAX_PARAM_LEN	100
 	FILE *fp;
 	char *line;
-	char opt[MAX_OPT_LEN];
-	char param[MAX_PARAM_LEN];
+	char opt[MAX_OPT_LEN + 1];
+	char param[MAX_PARAM_LEN + 1];
 	char c;		/* for the "" and '' check */
 	int tmp;
 	int line_num = 0;
@@ -243,6 +243,7 @@
 #endif
 	if (++recursion_depth > MAX_RECURSION_DEPTH) {
 		printf("too deep 'include'. check your configfiles\n");
+		--recursion_depth;
 		return -1;
 	}		
 
@@ -253,7 +254,7 @@
 		goto out;
 	}
 
-	if ((line = (char *) malloc(MAX_LINE_LEN)) == NULL) {
+	if ((line = (char *) malloc(MAX_LINE_LEN + 1)) == NULL) {
 		perror("parse_config_file: can't get memory for 'line'");
 		ret = -1;
 		goto out;