]> git.ipfire.org Git - thirdparty/git.git/commit - daemon.c
daemon: handle NULs in extended attribute string
authorJeff King <peff@peff.net>
Thu, 25 Jan 2018 00:56:20 +0000 (19:56 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 25 Jan 2018 21:50:17 +0000 (13:50 -0800)
commit550fbcad1c464df9e32cab15a8c6a01f91b1629c
tree8a32f4ef94a53c590c167052c6bec9ca54d1c6aa
parent19136be3f874ac265195ef35a8c5ed6c417eaea2
daemon: handle NULs in extended attribute string

If we receive a request with extended attributes after the
NUL, we try to write those attributes to the log. We do so
with a "%s" format specifier, which will only show
characters up to the first NUL.

That's enough for printing a "host=" specifier. But since
dfe422d04d (daemon: recognize hidden request arguments,
2017-10-16) we may have another NUL, followed by protocol
parameters, and those are not logged at all.

Let's cut out the attempt to show the whole string, and
instead log when we parse individual attributes. We could
leave the "extended attributes (%d bytes) exist" part of the
log, which in theory could alert us to attributes that fail
to parse. But anything we don't parse as a "host=" parameter
gets blindly added to the "protocol" attribute, so we'd see
it in that part of the log.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
daemon.c
t/t5570-git-daemon.sh