git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] wt-status: Don't find scissors line beyond buf len

From
Florian Schmidt <flosch@nutanix.com>
Date
Mar 8, 2024, 09:13 UTC
Message-ID
<d280a87b-e6ab-4f0d-b112-bbedc223c9fd@nutanix.com>
In-Reply-To
<xmqqsf11ltrt.fsf@gitster.g>
On 07/03/2024 19:35, Junio C Hamano wrote:
Show 8 quoted lines
> Florian Schmidt <flosch@nutanix.com> writes:
> 
>> Side remark: Since strstr() doesn't consider len, and will always search
>> up to a null byte, I now wonder whether it would be safer to create a
>> new strbuf that only contains the len bytes we want to operate on.
> 
> That is a valid concern in general, but does not seem to apply to
> the current codebase.  Thanks for being careful.

Thanks, that confirms my cursory look at the consumers of the function. If you think that it's unlikely that in the future, a new user of this function would provide a non-terminated string, then there is no need for action. I guess the aim is to use strbufs wherever suitable in the first place, anyway, and those won't have this issue?

Cheers, flosch

Previous: Junio C Hamano
Message 14 of 14 in “wt-status: Don't find scissors line beyond buf len”
  1. wt-status: Don't find scissors line beyond buf lenFlorian Schmidt, Mar 7, 2024
  2. Junio C HamanoMar 7, 2024
  3. Junio C HamanoMar 7, 2024
  4. Eric SunshineMar 7, 2024
  5. Kristoffer HaugsbakkMar 7, 2024
  6. Junio C HamanoMar 7, 2024
  7. Eric SunshineMar 7, 2024
  8. Kristoffer HaugsbakkMar 7, 2024
  9. Florian SchmidtMar 8, 2024
  10. Junio C HamanoMar 8, 2024
  11. Florian SchmidtMar 8, 2024
  12. Linus ArverApr 6, 2024
  13. Junio C HamanoMar 7, 2024
  14. Florian SchmidtMar 8, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.