[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

config parser bug



Hi,

I came across a bug in the config parser.  It assumes every line in the
config has a space in it and treats everything before it as the key and
everything after it as the value.  If there is no space in a line, the
value is null and segfaults on a strlen later on.

This patch just checks for a null val and returns an error.

John.
-- 
GPG: B89C D450 5B2C 74D8 58FB  A360 9B06 B5C2 26F0 3047
URL: http://www.johnleach.co.uk
--- firestorm-snapshot/src/conf.c	2004-04-25 23:10:23.000000000 +0100
+++ firestorm-devel/src/conf.c	2004-05-19 07:51:34.632536792 +0100
@@ -280,6 +280,11 @@
 		}
 	}
 
+	if (val == NULL) {
+		mesg(M_ERR, "%s:%u: parse error: %s", fn, line, buf);
+		return 0;
+	}
+
 	switch ( arg_dispatch(firestorm_args, buf, val, NULL) ) {
 	case -1:
 		mesg(M_ERR, "%s:%u: parse error: %s", fn, line, buf);

Attachment: signature.asc
Description: This is a digitally signed message part