Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Small correction in reading of commit headers
author
Alex Riesen
<raa.lkml@gmail.com>
Fri, 4 May 2007 21:51:32 +0000
(23:51 +0200)
committer
Junio C Hamano
<junkio@cox.net>
Sun, 6 May 2007 06:46:18 +0000
(23:46 -0700)
Check if a line of the header has enough characters to possibly
contain the requested prefix.
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
commit.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
cf593cc
)
diff --git
a/commit.c
b/commit.c
index eb911f44d7b0d78d884e901430cc34a300f7af21..7d78e786e9a6a6a3566cb7aa6555a815d79f9e4b 100644
(file)
--- a/
commit.c
+++ b/
commit.c
@@
-640,7
+640,9
@@
static char *get_header(const struct commit *commit, const char *key)
next = NULL;
} else
next = eol + 1;
- if (!strncmp(line, key, key_len) && line[key_len] == ' ') {
+ if (eol - line > key_len &&
+ !strncmp(line, key, key_len) &&
+ line[key_len] == ' ') {
int len = eol - line - key_len;
char *ret = xmalloc(len);
memcpy(ret, line + key_len + 1, len - 1);