From: "Sebastien Tardif via GitGitGadget" <gitgitgadget@gmail•com>
To: git@vger•kernel.org
Cc: Patrick Steinhardt <ps@pks•im>,
Sebastien Tardif <sebtardif@ncf•ca>,
Sebastien Tardif <sebtardif@ncf•ca>
Subject: [PATCH v3 3/3] daemon: guard NULL REMOTE_PORT in execute() logging
Date: Thu, 28 May 2026 02:56:56 +0000 [thread overview]
Message-ID: <4e742940711c71da755528ee0f4669125218aa66.1779937016.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.2300.v3.git.git.1779937016.gitgitgadget@gmail.com>
From: Sebastien Tardif <sebtardif@ncf•ca>
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 <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
prev parent reply other threads:[~2026-05-28 2:57 UTC|newest]
Thread overview: 16+ 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 ` [PATCH 3/3] daemon: guard NULL REMOTE_PORT in execute() logging Sebastien Tardif via GitGitGadget
2026-05-14 19:20 ` [PATCH 0/3] daemon: fix network address handling bugs Junio C Hamano
2026-05-15 7:31 ` Patrick Steinhardt
2026-05-27 18:18 ` [PATCH v2 " Sebastien Tardif via GitGitGadget
2026-05-27 18:18 ` [PATCH v2 1/3] daemon: fix IPv6 address corruption in lookup_hostname() Sebastien Tardif via GitGitGadget
2026-05-27 18:18 ` [PATCH v2 2/3] daemon: fix IPv6 address truncation in ip2str() Sebastien Tardif via GitGitGadget
2026-05-27 18:18 ` [PATCH v2 3/3] daemon: guard NULL REMOTE_PORT in execute() logging Sebastien Tardif via GitGitGadget
2026-05-27 21:00 ` [PATCH v2 0/3] daemon: fix network address handling bugs Junio C Hamano
2026-05-28 2:56 ` [PATCH v3 " Sebastien Tardif via GitGitGadget
2026-05-28 2:56 ` [PATCH v3 1/3] daemon: fix IPv6 address corruption in lookup_hostname() Sebastien Tardif via GitGitGadget
2026-05-28 2:56 ` [PATCH v3 2/3] daemon: fix IPv6 address truncation in ip2str() Sebastien Tardif via GitGitGadget
2026-05-28 2:56 ` Sebastien Tardif via GitGitGadget [this message]
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=4e742940711c71da755528ee0f4669125218aa66.1779937016.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=ps@pks$(echo .)im \
--cc=sebtardif@ncf$(echo .)ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox