Thread (1 message) 1 message, 1 author, 2024-02-06

Re: [PATCH] commit.c: ensure strchrnul() doesn't scan beyond range

From: Junio C Hamano <hidden>
Date: 2024-02-06 18:44:29

René Scharfe [off-list ref] writes:
quoted
 	while (line && line < msg + len) {
 		const char *eol = strchrnul(line, '\n');
+		assert(eol - line <= len);
Something like this might work in Verse, but C is more simple-minded.
You can't undo an out-of-bounds access after the fact, and assert()
would be compiled out if the code is built with NDEBUG anyway.
Good comments.  Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help