Don't use uninitialized variable#1816
Conversation
82dac1a to
6129430
Compare
Is it? I see the only user to be buf->st_mode = file_attr_to_st_mode(fdata.dwFileAttributes,
findbuf.dwReserved0, file_name);... and if ((attr & FILE_ATTRIBUTE_REPARSE_POINT) &&
tag == IO_REPARSE_TAG_SYMLINK) {In other words, the Having said that, with a more accurate commit message, I would love to merge this, as it makes it easier to reason about the correctness of the code. |
Signed-off-by: Sven Strickroth <email@cs-ware.de>
6129430 to
f910d5e
Compare
|
@dscho |
|
Thank you so much, especially for your patience! |
The usage of the uninitialized variable
findbufon https://github.com/git-for-windows/git/blob/master/compat/mingw.c#L858 causes undefined behavior in libgit (ifif (fdata.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) {is false).This is fixed by initializing it properly which is only present in Git for Windows but not vanilla Git.