Commit 5ba7c4cbae5b3af908df1e9e78eb703810d7f43d

Vicent Martí 2011-04-23T14:01:01

Merged pull request #143 from nordsturm/fix_loop. Fix going into infinite loop in read_header_loose()

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/src/odb_loose.c b/src/odb_loose.c
index 8ee01cd..4f475f2 100644
--- a/src/odb_loose.c
+++ b/src/odb_loose.c
@@ -434,6 +434,9 @@ static int read_header_loose(git_rawobj *out, const char *loc)
 		if ((read_bytes = read(fd, raw_buffer, sizeof(raw_buffer))) > 0) {
 			set_stream_input(&zs, raw_buffer, read_bytes);
 			z_return = inflate(&zs, 0);
+		} else {
+			z_return = Z_STREAM_END;
+			break;
 		}
 	} while (z_return == Z_OK);