Commit 2f683f00971239007e1d602ec1a71a1eb10f4f5e

Philip Kelley 2012-11-09T15:39:25

Fix uninitialized memory in winhttp subtransport on 64-bit

diff --git a/src/transports/winhttp.c b/src/transports/winhttp.c
index 44617f3..df6cd87 100644
--- a/src/transports/winhttp.c
+++ b/src/transports/winhttp.c
@@ -278,6 +278,7 @@ static int winhttp_stream_read(
 {
 	winhttp_stream *s = (winhttp_stream *)stream;
 	winhttp_subtransport *t = OWNING_SUBTRANSPORT(s);
+	DWORD dw_bytes_read;
 
 replay:
 	/* Connect if necessary */
@@ -376,12 +377,14 @@ replay:
 	if (!WinHttpReadData(s->request,
 		(LPVOID)buffer,
 		buf_size,
-		(LPDWORD)bytes_read))
+		&dw_bytes_read))
 	{
 		giterr_set(GITERR_OS, "Failed to read data");
 		return -1;
 	}
 
+	*bytes_read = dw_bytes_read;
+
 	return 0;
 }