Re: [PATCH] wt-status: Don't find scissors line beyond buf len
On Thu, Mar 7, 2024 at 3:47 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 14 quoted lines
> * So here is the version I queued. I have a new paragraph at the
> end of the log message to talk about use of strstr() and how it
> is OK in the current codebase.
> [jc: tweaked the commit log message and the implementation a bit]
>
> From: Florian Schmidt <flosch@nutanix.com>
>
> In general, if wt_status_locate_end() is given a piece of the memory
> that lacks NUL at all, strstr() may continue across page boundaries
> and run into an unmapped page. For our current callers, this is not
> a problem, as all of them except one uses a memory owned by a strbuf
> (which guarantees an implicit NUL-termination after its payload),
> and the one exeption in trailer.c:find_end_of_log_message() uses
> strlen() to compute the length before calling this function.