From: Junio C Hamano Date: Fri, 22 Dec 2006 07:49:13 +0000 (-0800) Subject: commit-tree: do not overflow MAXPARENT X-Git-Tag: v1.5.0-rc0~38 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2295e8d0c4cec41fbe257ddb957516a7c1a139df;p=git.git 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 --- 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);