From: Junio C Hamano Date: Thu, 16 Jun 2022 20:20:39 GMT Subject: Re: [PATCH 01/11] mingw: avoid accessing uninitialized memory in `is_executable()` Message-ID: In-Reply-To: Junio C Hamano writes: >> Hmm, but buf _is_ initialized fully? Line 149: >> >> char buf[3] = { 0 }; > > Ahh, yeah, that changes the landscape quite a bit. Just for reference, this piece of code has been correct ever since it was introduced to help.c by cc3b7a97 (Windows: Make 'git help -a' work., 2008-01-14). With a larger context, we can see buf[3] that is NUL filled, which receives 2 bytes by read(), and strcmp() does look semantically more correct than memcmp(), even though there probably shouldn't be any correctness or performance difference. So, strcmp -> memcmp in this case is a strict dis-improvement. I merged it already to 'next', but I haven't pushed the result out, so I'll redo 'next' before I push the result out. Thanks.