]> git.ipfire.org Git - thirdparty/git.git/commit
daemon: guard NULL REMOTE_PORT in execute() logging
authorSebastien Tardif <sebtardif@ncf.ca>
Wed, 27 May 2026 18:18:31 +0000 (18:18 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 27 May 2026 20:28:37 +0000 (05:28 +0900)
commit44c3f0fa1dead378527559ea89ba571e30ccd291
tree95f4a35615ae8ad574018279acc119fa9be20dac
parent93a64929c0b654a4eb84458cb10cd9f469b7ee89
daemon: guard NULL REMOTE_PORT in execute() logging

REMOTE_ADDR and REMOTE_PORT are both set by the same code path in
handle(), so neither should be NULL independently. However, the
existing code checks REMOTE_ADDR before the loginfo() call but not
REMOTE_PORT. If REMOTE_PORT were unset, NULL would be passed to
printf's %s, which is undefined behavior.

Add a fallback string for the NULL case, matching the existing
REMOTE_ADDR guard for consistency.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
daemon.c