From 2295e8d0c4cec41fbe257ddb957516a7c1a139df Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 21 Dec 2006 23:49:13 -0800 Subject: [PATCH] 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 --- builtin-commit-tree.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/builtin-commit-tree.c b/builtin-commit-tree.c index 856f3cd84..bc2877066 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); -- 2.30.2