From: Sebastien Tardif via GitGitGadget Date: Thu, 28 May 2026 02:56:56 GMT Subject: [PATCH v3 3/3] daemon: guard NULL REMOTE_PORT in execute() logging Message-ID: <4e742940711c71da755528ee0f4669125218aa66.1779937016.git.gitgitgadget@gmail.com> In-Reply-To: From: Sebastien Tardif REMOTE_ADDR and REMOTE_PORT are both set by the same code path in handle(), so when the existing REMOTE_ADDR check passes, REMOTE_PORT is guaranteed to be non-NULL. Guard REMOTE_PORT as well so that a future change that breaks this invariant does not pass NULL to printf's %s, which is undefined behavior. Signed-off-by: Sebastien Tardif --- daemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon.c b/daemon.c index 103c08d868..78cca8673f 100644 --- a/daemon.c +++ b/daemon.c @@ -753,7 +753,7 @@ static int execute(void) struct strvec env = STRVEC_INIT; if (addr) - loginfo("Connection from %s:%s", addr, port); + loginfo("Connection from %s:%s", addr, port ? port : "?"); set_keep_alive(0); alarm(init_timeout ? init_timeout : timeout); -- gitgitgadget