Commit e6b8b8905c5a1967c31bf6b8abed6d6b05fbff14

Christian Weisgerber 2020-12-29T15:12:53

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/tog/tog.c b/tog/tog.c
index 08cf77f..b39c45d 100644
--- a/tog/tog.c
+++ b/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);
 }