summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);