git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/12] read_object_with_reference: don't read beyond the buffer
@ 2008-02-18 20:47 Martin Koegler
  2008-02-18 20:47 ` [PATCH 02/12] get_sha1_oneline: check return value of parse_object Martin Koegler
  0 siblings, 1 reply; 13+ messages in thread
From: Martin Koegler @ 2008-02-18 20:47 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Martin Koegler

Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
---
 sha1_file.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/sha1_file.c b/sha1_file.c
index 4179949..d9da7c8 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;
-- 
1.5.4.1.g96b77

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2008-02-19 21:32 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-18 20:47 [PATCH 01/12] read_object_with_reference: don't read beyond the buffer Martin Koegler
2008-02-18 20:47 ` [PATCH 02/12] get_sha1_oneline: check return value of parse_object Martin Koegler
2008-02-18 20:47   ` [PATCH 03/12] mark_blob/tree_uninteresting: check for NULL Martin Koegler
2008-02-18 20:47     ` [PATCH 04/12] add_one_tree: handle NULL from lookup_tree Martin Koegler
2008-02-18 20:47       ` [PATCH 05/12] process_tree/blob: check for NULL Martin Koegler
2008-02-18 20:47         ` [PATCH 06/12] check results of parse_commit in merge_bases Martin Koegler
2008-02-18 20:47           ` [PATCH 07/12] peel_onion: handle NULL Martin Koegler
2008-02-18 20:47             ` [PATCH 08/12] process_tag: handle tag->tagged == NULL Martin Koegler
2008-02-18 20:48               ` [PATCH 09/12] process_tree/blob: check for NULL Martin Koegler
2008-02-18 20:48                 ` [PATCH 10/12] revision.c: handle tag->tagged == NULL Martin Koegler
2008-02-18 20:48                   ` [PATCH 11/12] parse_commit: don't fail, if object is NULL Martin Koegler
2008-02-18 20:48                     ` [PATCH 12/12] check return value from parse_commit Martin Koegler
2008-02-19 21:31         ` [PATCH 05/12] process_tree/blob: check for NULL Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).