From 14b0bcc93a72bb46eb9aa3b5d64cbe3d6117fd26 Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Wed, 25 Sep 2019 13:16:18 -0400 Subject: [PATCH] turn assert into run-time check. Fixes #3008 --- src/lib/server/cf_parse.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib/server/cf_parse.c b/src/lib/server/cf_parse.c index 1c05d5935a37..dfed273a33dc 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;