Merge branch 'maint'
authorJunio C Hamano <gitster@pobox.com>
Sun, 1 Feb 2009 01:42:26 +0000 (17:42 -0800)
committerJunio C Hamano <gitster@pobox.com>
Sun, 1 Feb 2009 01:42:26 +0000 (17:42 -0800)
* maint:
merge: fix out-of-bounds memory access

1  2 
unpack-trees.c
diff --combined unpack-trees.c
index 16bc2ca9eb0fe46b90969ba4855d9b4d89369f42,3a4e181af43add517a7a86511c17e4198552289c..e547282ed5c0027b35cbbd8e4f07bf968c6f2171
@@@ -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;
  
  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)) {