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>
diff --git a/builtin-commit-tree.c b/builtin-commit-tree.c
index 856f3cd..bc28770 100644
--- a/builtin-commit-tree.c
+++ b/builtin-commit-tree.c
@@ -101,6 +101,9 @@
 		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);