threads / patch / 19373

patch, 11 partshttp-push: do not SEGV after fetching a bad pack idx file

Subject: [PATCH 05/11] http-push: do not SEGV after fetching a bad pack idx file

## tl;dr

One message between May 16, 2009 and May 16, 2009. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Tay Ray Chuan· May 16, 2009, 03:51 UTC · lore

In a70c232 ("http-fetch: do not SEGV after fetching a bad pack idx file"), changes were made to the setup_index method in http-fetch.c (known in its present form as http-walker.c after 30ae764 ("Modularize commit-walker")). Since http-push.c has similar similar code for processing index files, these changes should apply to http-push.c's implementation of setup_index as well.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
---
 http-push.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
Show changes to http-push.c +2 −0
diff --git a/http-push.c b/http-push.c
index 1011ca8..875b2c6 100644
--- a/http-push.c
+++ b/http-push.c
@@ -1060,6 +1060,8 @@ static int setup_index(unsigned char *sha1)
 		return -1;
 
 	new_pack = parse_pack_index(sha1);
+	if (!new_pack)
+		return -1; /* parse_pack_index() already issued error message */
 	new_pack->next = repo->packs;
 	repo->packs = new_pack;
 	return 0;
-- 
1.6.3.rc0

← back to recent threads