Re: What's cooking in git.git (Dec 2019, #04; Tue, 17)
From: Junio C Hamano <hidden>
Date: 2019-12-18 18:01:35
Elijah Newren [off-list ref] writes:
On Tue, Dec 17, 2019 at 2:03 PM Junio C Hamano [off-list ref] wrote:quoted
* en/fill-directory-fixes (2019-12-11) 8 commits - dir: consolidate similar code in treat_directory() - dir: synchronize treat_leading_path() and read_directory_recursive() - dir: fix checks on common prefix directory - dir: break part of read_directory_recursive() out for reuse - dir: exit before wildcard fall-through if there is no wildcard - dir: remove stray quote character in comment - Revert "dir.c: make 'git-status --ignored' work within leading directories" - t3011: demonstrate directory traversal failures Assorted fixes to the directory traversal API. Will merge to 'next'.Please hold; even if you are willing to accept a manufactured dirent, the discussion did highlight two bugs in this series: 1) I shouldn't assume dirent has a d_type member; my one access to it should be guarded with a !defined(NO_D_TYPE_IN_DIRENT).
Thanks, yes, that should be done.
2) I should allocate my dirent on the heap (with some extra buffer space) rather than the stack, because if dirent has a "char d_name[]" rather than a "char d_name[BIG_ENOUGH]" declaration, then my stack-based allocation followed by writing to d_name will smash the stack.
Yes, or BIG_ENOUGH may not be long enough for the name you are creating.
I'll submit a re-roll with those two things fixed.
Thanks.