All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Sebastien Tardif via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Sebastien Tardif <sebtardif@ncf.ca>, Sebastien Tardif <sebtardif@ncf.ca>
Subject: [PATCH 3/3] daemon: guard NULL REMOTE_PORT in execute() logging
Date: Thu, 14 May 2026 15:46:32 +0000	[thread overview]
Message-ID: <1b2f9d1a07b6e93cc9e137b4fdf6e8f5fee9214e.1778773592.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.2300.git.git.1778773592.gitgitgadget@gmail.com>

From: Sebastien Tardif <sebtardif@ncf.ca>

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 <sebtardif@ncf.ca>
---
 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

  parent reply	other threads:[~2026-05-14 15:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-14 15:46 [PATCH 0/3] daemon: fix network address handling bugs Sebastien Tardif via GitGitGadget
2026-05-14 15:46 ` [PATCH 1/3] daemon: fix IPv6 address corruption in lookup_hostname() Sebastien Tardif via GitGitGadget
2026-05-14 21:26   ` Junio C Hamano
2026-05-14 15:46 ` [PATCH 2/3] daemon: fix IPv6 address truncation in ip2str() Sebastien Tardif via GitGitGadget
2026-05-14 15:46 ` Sebastien Tardif via GitGitGadget [this message]
2026-05-14 19:20 ` [PATCH 0/3] daemon: fix network address handling bugs Junio C Hamano
2026-05-15  7:31   ` Patrick Steinhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1b2f9d1a07b6e93cc9e137b4fdf6e8f5fee9214e.1778773592.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=sebtardif@ncf.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.