Skip to contentSkip to conversation

http-fetch: fix possible segfault

PATCH New Nick Hengeveld 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 http-fetch: fix possible segfault

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.

---
 http-fetch.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
http-fetch.c +1 -0
index 661c909..d3602b7 100644
@@ -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) {
Signature · 1 line
1.4.0.rc1.gf75c7-dirty