summaryrefslogtreecommitdiff
path: root/builtin-shortlog.c
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2006-11-19 16:28:25 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-11-20 06:59:05 (GMT)
commit72019cdefeb6b8fd7e8bff37b9c087302a45e29e (patch)
treede3ca8ca0f4a62fef84288560ac31f686270ca83 /builtin-shortlog.c
parentb8ec59234ba2c1833e29eece9ed87f7a471cbae2 (diff)
downloadgit-72019cdefeb6b8fd7e8bff37b9c087302a45e29e.zip
git-72019cdefeb6b8fd7e8bff37b9c087302a45e29e.tar.gz
git-72019cdefeb6b8fd7e8bff37b9c087302a45e29e.tar.bz2
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>
Diffstat (limited to 'builtin-shortlog.c')
-rw-r--r--builtin-shortlog.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/builtin-shortlog.c b/builtin-shortlog.c
index 48a2a0b..26212b0 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;
+ }
}
}