diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
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.
Diffstat (limited to '')
-rwxr-xr-xtests/t0205-config.sh16
1 file changed, 16 insertions, 0 deletions
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 "</html>" tmp &&
+ ! grep Smuggled tmp
+'
+
test_done