From: Matthew Dillon Date: Mon, 14 Dec 2009 16:01:57 +0000 (-0800) Subject: HAMMER Utility - Fix seg-fault in hammer cleanup if blank lines in config X-Git-Tag: v2.7.1~303 X-Git-Url: http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/743332ab9fb2411f4676b35af2c2a0dfadee5f69 HAMMER Utility - Fix seg-fault in hammer cleanup if blank lines in config * If the HAMMER config contained blank lines the hammer cleanup directive would seg-fault trying to parse it. * Ignore blank lines. Also ignore lines beginning with a '#' when parsing the config. Reported-by: elekktretterr@exemail.com.au --- diff --git a/sbin/hammer/cmd_cleanup.c b/sbin/hammer/cmd_cleanup.c index 6a198f2..e5d9e2d 100644 --- a/sbin/hammer/cmd_cleanup.c +++ b/sbin/hammer/cmd_cleanup.c @@ -396,6 +396,9 @@ do_cleanup(const char *path) cbase = cptr + 1; cmd = strtok(buf, WS); + if (cmd == NULL || cmd[0] == '#') + continue; + arg1 = 0; arg2 = 0; arg3 = NULL;