From: Junio C Hamano Date: Sun, 1 Feb 2009 01:42:26 +0000 (-0800) Subject: Merge branch 'maint' X-Git-Tag: v1.6.2-rc0~51 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/ddebfd1f27110bbcd0e8da0417bc425509af219a?hp=-c Merge branch 'maint' * maint: merge: fix out-of-bounds memory access --- ddebfd1f27110bbcd0e8da0417bc425509af219a diff --combined unpack-trees.c index 16bc2ca9eb,3a4e181af4..e547282ed5 --- a/unpack-trees.c +++ b/unpack-trees.c @@@ -61,7 -61,7 +61,7 @@@ static void unlink_entry(struct cache_e char *cp, *prev; char *name = ce->name; - if (has_symlink_leading_path(ce_namelen(ce), ce->name)) + if (has_symlink_or_noent_leading_path(ce_namelen(ce), ce->name)) return; if (unlink(name)) return; @@@ -240,8 -240,11 +240,11 @@@ static struct cache_entry *create_ce_en return ce; } - static int unpack_nondirectories(int n, unsigned long mask, unsigned long dirmask, struct cache_entry *src[5], - const struct name_entry *names, const struct traverse_info *info) + static int unpack_nondirectories(int n, unsigned long mask, + unsigned long dirmask, + struct cache_entry **src, + const struct name_entry *names, + const struct traverse_info *info) { int i; struct unpack_trees_options *o = info->data; @@@ -291,7 -294,7 +294,7 @@@ static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, struct name_entry *names, struct traverse_info *info) { - struct cache_entry *src[5] = { NULL, }; + struct cache_entry *src[MAX_UNPACK_TREES + 1] = { NULL, }; struct unpack_trees_options *o = info->data; const struct name_entry *p = names; @@@ -580,7 -583,7 +583,7 @@@ static int verify_absent(struct cache_e if (o->index_only || o->reset || !o->update) return 0; - if (has_symlink_leading_path(ce_namelen(ce), ce->name)) + if (has_symlink_or_noent_leading_path(ce_namelen(ce), ce->name)) return 0; if (!lstat(ce->name, &st)) {