From: Alan T. DeKok Date: Thu, 29 Sep 2011 09:26:03 +0000 (+0200) Subject: Be more graceful if caller passes us a NULL ptr X-Git-Tag: release_3_0_0_beta0~618 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a241c89ff3e2395ad0a523d5f9640efdb3affa2;p=thirdparty%2Ffreeradius-server.git Be more graceful if caller passes us a NULL ptr --- diff --git a/src/main/conffile.c b/src/main/conffile.c index 35d3c6c2015..dcadadaed08 100644 --- a/src/main/conffile.c +++ b/src/main/conffile.c @@ -2056,6 +2056,8 @@ CONF_PAIR *cf_pair_find_next(const CONF_SECTION *cs, { CONF_ITEM *ci; + if (!cs) return NULL; + /* * If pair is NULL this must be a first time run * Find the pair with correct name @@ -2184,6 +2186,8 @@ CONF_SECTION *cf_subsection_find_next(CONF_SECTION *section, { CONF_ITEM *ci; + if (!section) return NULL; + /* * If subsection is NULL this must be a first time run * Find the subsection with correct name @@ -2217,6 +2221,8 @@ CONF_SECTION *cf_section_find_next(CONF_SECTION *section, CONF_SECTION *subsection, const char *name1) { + if (!section) return NULL; + if (!section->item.parent) return NULL; return cf_subsection_find_next(section->item.parent, subsection, name1); @@ -2228,6 +2234,8 @@ CONF_SECTION *cf_section_find_next(CONF_SECTION *section, CONF_ITEM *cf_item_find_next(CONF_SECTION *section, CONF_ITEM *item) { + if (!section) return NULL; + /* * If item is NULL this must be a first time run * Return the first item