提交 72019cde 编写于 作者: J Johannes Schindelin 提交者: Junio C Hamano

shortlog: do not crash on parsing "[PATCH"

Annoyingly, it looked for the closing bracket in the author name
instead of in the message, and then accessed the NULL pointer.
Signed-off-by: NJohannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: NJunio C Hamano <junkio@cox.net>
上级 b8ec5923
......@@ -108,13 +108,15 @@ static void insert_author_oneline(struct path_list *list,
free(buffer);
if (!strncmp(oneline, "[PATCH", 6)) {
char *eob = strchr(buffer, ']');
while (isspace(eob[1]) && eob[1] != '\n')
eob++;
if (eob - oneline < onelinelen) {
onelinelen -= eob - oneline;
oneline = eob;
char *eob = strchr(oneline, ']');
if (eob) {
while (isspace(eob[1]) && eob[1] != '\n')
eob++;
if (eob - oneline < onelinelen) {
onelinelen -= eob - oneline;
oneline = eob;
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册