Thread (1 message) 1 message, 1 author, 2021-03-17

Re: [PATCH] fsmonitor: avoid global-buffer-overflow READ when checking trivial response

From: Junio C Hamano <hidden>
Date: 2021-03-17 17:11:40

Jeff Hostetler [off-list ref] writes:
On 3/15/21 12:39 PM, Andrzej Hunt via GitGitGadget wrote:
quoted
From: Andrzej Hunt <redacted>
query_result can be be an empty strbuf (STRBUF_INIT) - in that case
trying to read 3 bytes triggers a buffer overflow read (as
query_result.buf = '\0').
Therefore we need to check query_result's length before trying to
read 3
bytes.
This overflow was introduced in:
   940b94f35c (fsmonitor: log invocation of FSMonitor hook to trace2, 2021-02-03)
It was found when running the test-suite against ASAN, and can be most
easily reproduced with the following command:
...
Looks good to me.  And thanks for catching this.
Thanks, will queue on jh/fsmonitor-prework as a maint-2.31 candidate.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help