diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-02-18 20:56:01 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-02-18 20:56:01 -0800 |
commit | ee4f06c0a60d8b17efdd8f6a3332f175f6aafe0e (patch) | |
tree | b73e7c94f1cadff7cdaae5e4ddc27e7dda1c2f02 /sha1_file.c | |
parent | 3d51e1b5b84bde24f9a19e3cee603f0b57f62001 (diff) | |
parent | f73df331a43a6092af427fd30bb6ce07f313743c (diff) | |
download | git-ee4f06c0a60d8b17efdd8f6a3332f175f6aafe0e.tar.gz |
Merge branch 'mk/maint-parse-careful'
* mk/maint-parse-careful:
peel_onion: handle NULL
check return value from parse_commit() in various functions
parse_commit: don't fail, if object is NULL
revision.c: handle tag->tagged == NULL
reachable.c::process_tree/blob: check for NULL
process_tag: handle tag->tagged == NULL
check results of parse_commit in merge_bases
list-objects.c::process_tree/blob: check for NULL
reachable.c::add_one_tree: handle NULL from lookup_tree
mark_blob/tree_uninteresting: check for NULL
get_sha1_oneline: check return value of parse_object
read_object_with_reference: don't read beyond the buffer
Diffstat (limited to 'sha1_file.c')
-rw-r--r-- | sha1_file.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sha1_file.c b/sha1_file.c index 41799492f9..d9da7c8f75 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -1943,7 +1943,8 @@ void *read_object_with_reference(const unsigned char *sha1, } ref_length = strlen(ref_type); - if (memcmp(buffer, ref_type, ref_length) || + if (ref_length + 40 > isize || + memcmp(buffer, ref_type, ref_length) || get_sha1_hex((char *) buffer + ref_length, actual_sha1)) { free(buffer); return NULL; |