Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2023-04-13 02:18:28 +0300
committerJohannes Schindelin <johannes.schindelin@gmx.de>2023-04-17 22:15:40 +0300
commit3bb3d6bac5f2b496dfa2862dc1a84cbfa9b4449a (patch)
tree5998a4e75b41a94e2bd66974d6ef0f1bf2a8544a /t/t1300-config.sh
parente91cfe6085c4a61372d1f800b473b73b8d225d0d (diff)
config.c: disallow overly-long lines in `copy_or_rename_section_in_file()`
As a defense-in-depth measure to guard against any potentially-unknown buffer overflows in `copy_or_rename_section_in_file()`, refuse to work with overly-long lines in a gitconfig. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Diffstat (limited to 't/t1300-config.sh')
-rwxr-xr-xt/t1300-config.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/t/t1300-config.sh b/t/t1300-config.sh
index 24c13b91db..de564cb8e5 100755
--- a/t/t1300-config.sh
+++ b/t/t1300-config.sh
@@ -633,6 +633,16 @@ test_expect_success 'renaming an embedded section with a long line' '
test_must_fail git config -f y foo.e
'
+test_expect_success 'renaming a section with an overly-long line' '
+ {
+ printf "[b]\\n" &&
+ printf " c = d %525000s e" " " &&
+ printf "[a] g = h\\n"
+ } >y &&
+ test_must_fail git config -f y --rename-section a xyz 2>err &&
+ test_i18ngrep "refusing to work with overly long line in .y. on line 2" err
+'
+
cat >> .git/config << EOF
[branch "zwei"] a = 1 [branch "vier"]
EOF