summaryrefslogtreecommitdiff
path: root/builtin-commit-tree.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-12-21 23:49:13 -0800
committerJunio C Hamano <junkio@cox.net>2006-12-21 23:49:13 -0800
commit2295e8d0c4cec41fbe257ddb957516a7c1a139df (patch)
tree91c2f64c8d95b9857e574239218cb63be8b51e3a /builtin-commit-tree.c
parentfa39b6b5b11f9b580c515a7b4a8e4eb8eaa79b75 (diff)
downloadgit-2295e8d0c4cec41fbe257ddb957516a7c1a139df.tar.gz
commit-tree: do not overflow MAXPARENT
We have a static allocation of MAXPARENT, but that limit was not enforced, other than by a lucky invocation of the program segfaulting. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-commit-tree.c')
-rw-r--r--builtin-commit-tree.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin-commit-tree.c b/builtin-commit-tree.c
index 856f3cd841..bc28770664 100644
--- a/builtin-commit-tree.c
+++ b/builtin-commit-tree.c
@@ -101,6 +101,9 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)
a = argv[i]; b = argv[i+1];
if (!b || strcmp(a, "-p"))
usage(commit_tree_usage);
+
+ if (parents >= MAXPARENT)
+ die("Too many parents (%d max)", MAXPARENT);
if (get_sha1(b, parent_sha1[parents]))
die("Not a valid object name %s", b);
check_valid(parent_sha1[parents], commit_type);