From: Arran Cudbard-Bell Date: Wed, 31 Dec 2014 18:51:54 +0000 (-0500) Subject: Add simple cycle detection to cf_item_add X-Git-Tag: release_3_0_7~383 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff23ebea94acfc498d84a8e0cda4c0f8a9e85b6b;p=thirdparty%2Ffreeradius-server.git Add simple cycle detection to cf_item_add --- diff --git a/src/main/conffile.c b/src/main/conffile.c index 3aba18be339..e9109f0ecfc 100644 --- a/src/main/conffile.c +++ b/src/main/conffile.c @@ -528,6 +528,10 @@ int cf_pair_replace(CONF_SECTION *cs, CONF_PAIR *cp, char const *value) */ void cf_item_add(CONF_SECTION *cs, CONF_ITEM *ci) { + CONF_ITEM *first = ci; + + rad_assert((void *)cs != (void *)ci); + if (!cs || !ci) return; if (!cs->children) { @@ -542,6 +546,8 @@ void cf_item_add(CONF_SECTION *cs, CONF_ITEM *ci) * Update the trees (and tail) for each item added. */ for (/* nothing */; ci != NULL; ci = ci->next) { + rad_assert(ci->next != first); /* simple cycle detection */ + cs->tail = ci; /*