Thread (1 message) 1 message, 1 author, 2022-06-16

Re: [PATCH 01/11] mingw: avoid accessing uninitialized memory in `is_executable()`

From: Junio C Hamano <hidden>
Date: 2022-06-16 20:20:49

Junio C Hamano [off-list ref] writes:
quoted
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help