Merge branch 'jh/untracked-cache-fix'

An under-allocation for the untracked cache data has been corrected.

* jh/untracked-cache-fix:
  dir: fix malloc of root untracked_cache_dir
This commit is contained in:
Junio C Hamano 2021-03-01 14:02:58 -08:00
commit 9889cff6d6

7
dir.c
View File

@ -2730,11 +2730,8 @@ static struct untracked_cache_dir *validate_untracked_cache(struct dir_struct *d
return NULL; return NULL;
} }
if (!dir->untracked->root) { if (!dir->untracked->root)
const int len = sizeof(*dir->untracked->root); FLEX_ALLOC_STR(dir->untracked->root, name, "");
dir->untracked->root = xmalloc(len);
memset(dir->untracked->root, 0, len);
}
/* Validate $GIT_DIR/info/exclude and core.excludesfile */ /* Validate $GIT_DIR/info/exclude and core.excludesfile */
root = dir->untracked->root; root = dir->untracked->root;