From: Shane Kerr Date: Wed, 11 Jul 2007 12:02:51 +0000 (+0000) Subject: Fix infinite loop if EOF in pool statement. X-Git-Tag: v4_0_0a3~36 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=237f8d3a7e9dbfc128704810960d8411a0601701;p=thirdparty%2Fdhcp.git Fix infinite loop if EOF in pool statement. See RT ticket #16977 for more. --- diff --git a/RELNOTES b/RELNOTES index f42ee8941..42c4f90c9 100644 --- a/RELNOTES +++ b/RELNOTES @@ -52,6 +52,12 @@ may not work on other platforms. Please report any problems and suggested fixes to . + Changes since 4.0.0a2 + +- Bug in server configuration parser caused server to get stuck on + startup for certain bad pool declarations. Thanks to Guillaume + Knispel for the bug report and fix. + Changes since 4.0.0a1 - Bug in octal parsing fixed. Thanks to Bernd Fuhrmann for the report diff --git a/server/confpars.c b/server/confpars.c index d0a377e76..92001b84c 100644 --- a/server/confpars.c +++ b/server/confpars.c @@ -34,7 +34,7 @@ #ifndef lint static char copyright[] = -"$Id: confpars.c,v 1.170 2007/06/28 17:19:55 dhankins Exp $ Copyright (c) 2004-2007 Internet Systems Consortium. All rights reserved.\n"; +"$Id: confpars.c,v 1.171 2007/07/11 12:02:51 shane Exp $ Copyright (c) 2004-2007 Internet Systems Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -1549,6 +1549,15 @@ void parse_pool_statement (cfile, group, type) done = 1; break; + case END_OF_FILE: + /* + * We can get to END_OF_FILE if, for instance, + * the parse_statement() reads all available tokens + * and leaves us at the end. + */ + parse_warn("unexpected end of file"); + goto cleanup; + default: declaration = parse_statement (cfile, pool -> group, POOL_DECL, @@ -1604,6 +1613,7 @@ void parse_pool_statement (cfile, group, type) log_error ("one range statement."); } +cleanup: /* Dereference the lease chain. */ lp = (struct lease *)0; while (lpchain) {