From 0cae2f05157ac4a3f9d482780de7f98070b02e97 Mon Sep 17 00:00:00 2001 From: William Lallemand Date: Fri, 21 Nov 2025 22:59:47 +0100 Subject: [PATCH] =?utf8?q?BUG/MINOR:=20acme:=20warning=20=E2=80=98ctx?= =?utf8?q?=E2=80=99=20may=20be=20used=20uninitialized?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Please compiler with maybe-uninitialized warning src/acme.c: In function ‘cli_acme_chall_ready_parse’: include/haproxy/task.h:215:9: error: ‘ctx’ may be used uninitialized [-Werror=maybe-uninitialized] 215 | _task_wakeup(t, f, MK_CALLER(WAKEUP_TYPE_TASK_WAKEUP, 0, 0)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/acme.c:2903:17: note: in expansion of macro ‘task_wakeup’ 2903 | task_wakeup(ctx->task, TASK_WOKEN_MSG); | ^~~~~~~~~~~ src/acme.c:2862:26: note: ‘ctx’ was declared here 2862 | struct acme_ctx *ctx; | ^~~ Backport to 3.2. --- src/acme.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/acme.c b/src/acme.c index 61cbb5bb1..17c8b1a5e 100644 --- a/src/acme.c +++ b/src/acme.c @@ -2859,7 +2859,7 @@ static int cli_acme_chall_ready_parse(char **args, char *payload, struct appctx char *msg = NULL; const char *crt; const char *dns; - struct acme_ctx *ctx; + struct acme_ctx *ctx = NULL; struct acme_auth *auth; int found = 0; int remain = 0; @@ -2897,13 +2897,14 @@ static int cli_acme_chall_ready_parse(char **args, char *payload, struct appctx if (!msg) memprintf(&msg, "Couldn't find the ACME task using crt \"%s\" and dns \"%s\" !\n", crt, dns); goto err; - } - - if (!remain) { - task_wakeup(ctx->task, TASK_WOKEN_MSG); - return cli_dynmsg(appctx, LOG_INFO, memprintf(&msg, "%d '%s' challenge(s) ready! All challenges ready, starting challenges validation!", found, dns)); } else { - return cli_dynmsg(appctx, LOG_INFO, memprintf(&msg, "%d '%s' challenge(s) ready! Remaining challenges to deploy: %d", found, dns, remain)); + if (!remain) { + if (ctx) + task_wakeup(ctx->task, TASK_WOKEN_MSG); + return cli_dynmsg(appctx, LOG_INFO, memprintf(&msg, "%d '%s' challenge(s) ready! All challenges ready, starting challenges validation!", found, dns)); + } else { + return cli_dynmsg(appctx, LOG_INFO, memprintf(&msg, "%d '%s' challenge(s) ready! Remaining challenges to deploy: %d", found, dns, remain)); + } } err: -- 2.47.3