Skip to content

Commit

Permalink
http-fetch: fix possible segfault
Browse files Browse the repository at this point in the history
Initialize an object request's slot to a safe value.  A non-NULL value
can cause a segfault if the request is aborted before it starts.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Nick Hengeveld authored and Junio C Hamano committed Jun 7, 2006
1 parent 5ad312b commit e8dff6b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions http-fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ void prefetch(unsigned char *sha1)
snprintf(newreq->filename, sizeof(newreq->filename), "%s", filename);
snprintf(newreq->tmpfile, sizeof(newreq->tmpfile),
"%s.temp", filename);
newreq->slot = NULL;
newreq->next = NULL;

if (object_queue_head == NULL) {
Expand Down

0 comments on commit e8dff6b

Please sign in to comment.