From: Johannes Schindelin Date: Sun, 19 Nov 2006 16:28:25 +0000 (+0100) Subject: shortlog: do not crash on parsing "[PATCH" X-Git-Tag: v1.5.0-rc0~212^2~6 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=72019cdefeb6b8fd7e8bff37b9c087302a45e29e;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/builtin-shortlog.c b/builtin-shortlog.c index 48a2a0b0d..26212b009 100644 --- a/builtin-shortlog.c +++ b/builtin-shortlog.c @@ -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; + } } }