From: Sebastien Tardif via GitGitGadget Date: Thu, 14 May 2026 15:46:32 GMT Subject: [PATCH 3/3] daemon: guard NULL REMOTE_PORT in execute() logging Message-ID: <1b2f9d1a07b6e93cc9e137b4fdf6e8f5fee9214e.1778773592.git.gitgitgadget@gmail.com> In-Reply-To: From: Sebastien Tardif The REMOTE_PORT environment variable is used in a format string without a NULL check, while REMOTE_ADDR is checked. If REMOTE_PORT is unset, NULL is passed to printf's %s, which is undefined behavior. Add a fallback string for the NULL case. 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