]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: cfgcond: always set the error string on awslc_api checks
authorWilly Tarreau <w@1wt.eu>
Fri, 3 Apr 2026 06:58:49 +0000 (08:58 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 3 Apr 2026 06:58:49 +0000 (08:58 +0200)
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.

src/cfgcond.c

index 9eebada3afccb4fb9076dc84123421fd88d676be..345eafe717c033592302987db92e0dac8c424439 100644 (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;