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: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Johannes Schindelin 2006-11-19 17:28:25 +01:00 коммит произвёл Junio C Hamano
Родитель b8ec59234b
Коммит 72019cdefe
1 изменённых файлов: 8 добавлений и 6 удалений

Просмотреть файл

@ -108,13 +108,15 @@ static void insert_author_oneline(struct path_list *list,
free(buffer);
if (!strncmp(oneline, "[PATCH", 6)) {
char *eob = strchr(buffer, ']');
char *eob = strchr(oneline, ']');
while (isspace(eob[1]) && eob[1] != '\n')
eob++;
if (eob - oneline < onelinelen) {
onelinelen -= eob - oneline;
oneline = eob;
if (eob) {
while (isspace(eob[1]) && eob[1] != '\n')
eob++;
if (eob - oneline < onelinelen) {
onelinelen -= eob - oneline;
oneline = eob;
}
}
}