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_2_1_12~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0513cbcff8aaf16523b5783d4ffdcb3ab922066;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 1e77b1ab055..4e159fde893 100644 --- a/src/main/conffile.c +++ b/src/main/conffile.c @@ -2016,6 +2016,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 @@ -2144,6 +2146,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 @@ -2177,6 +2181,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); @@ -2188,6 +2194,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