diff options
author | Alex Riesen <raa.lkml@gmail.com> | 2007-05-05 01:51:32 +0400 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-05-06 10:46:18 +0400 |
commit | e102d4353d7cfd69a597cd976eabdcb74641be69 (patch) | |
tree | 83c1756b9a4436c99ff85286a008852ef0912f51 | |
parent | cf593cc41828c6fc0a2cec50ddac0713ea8a07ec (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>
-rw-r--r-- | commit.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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); |