BUG/MINOR: cfgcond: always set the error string on awslc_api checks

Using awslc_api_before() with an invalid argument results in "(null)"
appearing in the error message due to -1 being returned without the
error message being filled. Let's always fill the error message on error.

This was introduced in 3.3 with commit 3d15c07ed0 ("MINOR: cfgcond: add
"awslc_api_atleast" and "awslc_api_before""), and this fix must be
backported to 3.3.
This commit is contained in:
Willy Tarreau 2026-04-03 08:58:49 +02:00
parent bf04e64f2c
commit f9ba750fd9

View File

@ -294,8 +294,10 @@ int cfg_eval_cond_term(const struct cfg_cond_term *term, char **err)
case CFG_PRED_AWSLC_API_ATLEAST: { // checks if the current AWSLC API is at least this one
int awslcret = awslc_compare_current_api(term->args[0].data.str.area);
if (awslcret < -1) /* can't parse the string or no AWS-LC available */
if (awslcret < -1) { /* can't parse the string or no AWS-LC available */
memprintf(err, "invalid argument to conditional expression predicate '%s': '%s'", term->pred->word, term->args[0].data.str.area);
ret = -1;
}
else
ret = awslcret <= 0;
break;
@ -303,8 +305,10 @@ int cfg_eval_cond_term(const struct cfg_cond_term *term, char **err)
case CFG_PRED_AWSLC_API_BEFORE: { // checks if the current AWSLC API is older than this one
int awslcret = awslc_compare_current_api(term->args[0].data.str.area);
if (awslcret < -1) /* can't parse the string or no AWS-LC available */
if (awslcret < -1) { /* can't parse the string or no AWS-LC available */
memprintf(err, "invalid argument to conditional expression predicate '%s': '%s'", term->pred->word, term->args[0].data.str.area);
ret = -1;
}
else
ret = awslcret > 0;
break;