Thread (12 messages) flat view 12 messages, 3 authors, 2016-06-15

Re: [PATCH 2/2] fast-import: validate entire ident string

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:48:42

Jonathan Nieder wrote:
-		lb = strstr(a + 8, " <");
-		rb = strstr(a + 8, "> ");
-		eol = strchr(a + 8, '\n');
+		n = a + strlen("\nauthor");
+		lb = strstr(n, " <");
+		rb = strstr(lb + 2, "> ");
+		eol = strchr(rb + 2, '\n');
 		if (!lb || !rb || !eol)
 			die("invalid commit: %s", use_message);
Err, this will segv when it fails; better to use

	lb = a + strlen("\nauthor ");
	lb = strchrnul(lb, '<');
	rb = strchrnul(lb, '>');
	eol = strchrnul(rb, '\n');
	if (!*lb || !*rb || !*eol)
		die("invalid commit: %s", use_message);

This is even more permissive, but I think that’s okay.

Sorry for the noise.
Jonathan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help