diff options
author | Junio C Hamano <junkio@cox.net> | 2005-11-14 18:39:18 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2005-11-14 18:39:18 -0800 |
commit | 60d64db4614b1007ca37c228923ec1964d5ad394 (patch) | |
tree | d376d7e422b9a6cc51ef9a4b7f90e59f5520247e /apply.c | |
parent | f7a2eb735982e921ae4379f1dcf5f7a023610393 (diff) | |
parent | d7bba815753bf8c31886fcf6bb89c9e6250674a5 (diff) | |
download | git-60d64db4614b1007ca37c228923ec1964d5ad394.tar.gz |
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'apply.c')
-rw-r--r-- | apply.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -370,7 +370,7 @@ static int gitdiff_index(const char *line, struct patch *patch) int len; ptr = strchr(line, '.'); - if (!ptr || ptr[1] != '.' || 40 <= ptr - line) + if (!ptr || ptr[1] != '.' || 40 < ptr - line) return 0; len = ptr - line; memcpy(patch->old_sha1_prefix, line, len); @@ -384,7 +384,7 @@ static int gitdiff_index(const char *line, struct patch *patch) ptr = eol; len = ptr - line; - if (40 <= len) + if (40 < len) return 0; memcpy(patch->new_sha1_prefix, line, len); patch->new_sha1_prefix[len] = 0; @@ -895,7 +895,8 @@ static int parse_chunk(char *buffer, unsigned long size, struct patch *patch) static const char binhdr[] = "Binary files "; if (sizeof(binhdr) - 1 < size - offset - hdrsize && - !memcmp(binhdr, buffer + hdrsize, sizeof(binhdr)-1)) + !memcmp(binhdr, buffer + hdrsize + offset, + sizeof(binhdr)-1)) patch->is_binary = 1; if (patch->is_binary && !apply && !check) |