From d0cece94a2f75a80aecef2105df2a21ff541bead Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 17 Oct 2026 12:53:19 -1000 Subject: Run a config comment to the end of its line skip_line stopped at a NUL as well as at a newline, so the rest of the comment after one was read as a setting. --- tests/t0205-config.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests') diff --git a/tests/t0205-config.sh b/tests/t0205-config.sh index 4691b8f..4536e49 100755 --- a/tests/t0205-config.sh +++ b/tests/t0205-config.sh @@ -95,4 +95,20 @@ test_expect_success 'a fully understood config stays silent' ' ! grep "\[cgit\]" err ' +# A comment runs to the end of its line, whatever bytes it holds, so nothing +# after a NUL inside one is read as a setting. +test_expect_success 'a NUL inside a comment does not end it' ' + { + echo "virtual-root=/" && + echo "cache-size=0" && + printf "# note\\000root-title=Smuggled\\n" && + echo "repo.url=foo" && + echo "repo.path=$PWD/repos/foo/.git" + } >nulrc && + grep -c Smuggled nulrc && + CGIT_CONFIG="$PWD/nulrc" QUERY_STRING="url=" cgit >tmp && + grep "" tmp && + ! grep Smuggled tmp +' + test_done -- cgit