aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorDeskin Miller <deskinm@umich.edu>2008-09-22 11:06:41 -0400
committerShawn O. Pearce <spearce@spearce.org>2008-09-24 08:58:14 -0700
commitdc4179f9a76473176eb473f6f568b0006c823fba (patch)
tree92f5313234d45db2628fb56d37c5e6171a46b09b /t
parentdb87e3960c5a770db13c9ba9602b5e88848e2d1a (diff)
downloadgit-dc4179f9a76473176eb473f6f568b0006c823fba.tar.gz
git-dc4179f9a76473176eb473f6f568b0006c823fba.tar.xz
maint: check return of split_cmdline to avoid bad config strings
As the testcase demonstrates, it's possible for split_cmdline to return -1 and deallocate any memory it's allocated, if the config string is missing an end quote. In both the cases below, which are the only calling sites, the return isn't checked, and using the pointer causes a pretty immediate segfault. Signed-off-by: Deskin Miller <deskinm@umich.edu> Acked-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 't')
-rwxr-xr-xt/t1300-repo-config.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 64567fb94..11b82f43d 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -741,4 +741,14 @@ test_expect_success 'symlinked configuration' '
'
+test_expect_success 'check split_cmdline return' "
+ git config alias.split-cmdline-fix 'echo \"' &&
+ test_must_fail git split-cmdline-fix &&
+ echo foo > foo &&
+ git add foo &&
+ git commit -m 'initial commit' &&
+ git config branch.master.mergeoptions 'echo \"' &&
+ test_must_fail git merge master
+ "
+
test_done