"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Christian Weisgerber <naddy@mips.inka.de>
Subject:
tog log: terminate author at '>'
To:
gameoftrees@openbsd.org
Date:
Tue, 29 Dec 2020 14:11:21 +0100

Download raw body.

Thread
tog log: terminate author field at '>' in case there is no '@'

This can be seen e.g. by cloning git://github.com/jonathangray/csrg.git
and running tog log on it.

ok?

diff c80f5f010956d72c751b435eca30d106a3ac5a26 /home/naddy/got
blob - 08cf77f7a05719d158b1827f0afc279321117475
file + tog/tog.c
--- tog/tog.c
+++ tog/tog.c
@@ -1308,14 +1308,12 @@ static const struct got_error *
 format_author(wchar_t **wauthor, int *author_width, char *author, int limit,
     int col_tab_align)
 {
-	char *smallerthan, *at;
+	char *smallerthan;
 
 	smallerthan = strchr(author, '<');
 	if (smallerthan && smallerthan[1] != '\0')
 		author = smallerthan + 1;
-	at = strchr(author, '@');
-	if (at)
-		*at = '\0';
+	author[strcspn(author, "@>")] = '\0';
 	return format_line(wauthor, author_width, author, limit, col_tab_align);
 }
 
-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de