From: Alan T. DeKok Date: Wed, 25 Sep 2019 17:16:18 +0000 (-0400) Subject: turn assert into run-time check. Fixes #3008 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=14b0bcc93a72bb46eb9aa3b5d64cbe3d6117fd26;p=thirdparty%2Ffreeradius-server.git turn assert into run-time check. Fixes #3008 --- diff --git a/src/lib/server/cf_parse.c b/src/lib/server/cf_parse.c index 1c05d5935a3..dfed273a33d 100644 --- a/src/lib/server/cf_parse.c +++ b/src/lib/server/cf_parse.c @@ -153,12 +153,18 @@ int cf_pair_parse_value(TALLOC_CTX *ctx, void *out, UNUSED void *base, CONF_ITEM return -1; } - rad_assert(cp->value); + /* + * Catch crazy errors. + */ + if (!cp->value) { + cf_log_err(cp, "Configuration pair \"%s\" must have a value", cf_pair_attr(cp)); + return -1; + } /* * Check for zero length strings */ - if (((!cp->value || cp->value[0] == '\0')) && cant_be_empty) { + if ((cp->value[0] == '\0') && cant_be_empty) { cf_log_err(cp, "Configuration pair \"%s\" must not be empty (zero length)", cf_pair_attr(cp)); if (!required) cf_log_err(cp, "Comment item to silence this message"); rcode = -1;