Skip to content

Commit

Permalink
turn assert into run-time check. Fixes #3008
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Sep 25, 2019
1 parent 8420840 commit 14b0bcc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/lib/server/cf_parse.c
Expand Up @@ -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;
Expand Down

0 comments on commit 14b0bcc

Please sign in to comment.