From: Junio C Hamano Date: Thu, 08 Feb 2024 21:44:48 GMT Subject: Re: [PATCH] commit.c: ensure strchrnul() doesn't scan beyond range Message-ID: In-Reply-To: <20240208214137.GB1090198@coredump.intra.peff.net> Jeff King writes: > 1. It is not possible for the buf/len pair we pass to check_nonce() to > contain a NUL. And thus there is no caller of find_header_mem() > that can contain an embedded NUL. So switching from strchrnul() to > just memchr() should be OK there. Correct. > 2. That raises the question of whether parse_signed_buffer() has a > similar walk-too-far problem. ;) The answer is no, because we feed > it from a strbuf. But it's not a great pattern overall. True, too. Thanks.