From: Florian Schmidt Date: Fri, 08 Mar 2024 09:13:12 GMT Subject: Re: [PATCH] wt-status: Don't find scissors line beyond buf len Message-ID: In-Reply-To: On 07/03/2024 19:35, Junio C Hamano wrote: > Florian Schmidt 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