Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Riesen <raa.lkml@gmail.com>2007-05-05 01:51:32 +0400
committerJunio C Hamano <junkio@cox.net>2007-05-06 10:46:18 +0400
commite102d4353d7cfd69a597cd976eabdcb74641be69 (patch)
tree83c1756b9a4436c99ff85286a008852ef0912f51 /commit.c
parentcf593cc41828c6fc0a2cec50ddac0713ea8a07ec (diff)
Small correction in reading of commit headers
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>
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/commit.c b/commit.c
index eb911f44d7..7d78e786e9 100644
--- 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);