From: William Lallemand Date: Fri, 21 Nov 2025 21:59:47 +0000 (+0100) Subject: BUG/MINOR: acme: warning ‘ctx’ may be used uninitialized X-Git-Tag: v3.3.0~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0cae2f05157ac4a3f9d482780de7f98070b02e97;p=thirdparty%2Fhaproxy.git BUG/MINOR: acme: warning ‘ctx’ may be used uninitialized 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. --- 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: