Commit 186c054d6556d6dfe8b9e17e82990603b4b33b5a

Joshua Peek 2012-08-09T14:47:29

Revert implementation changes

diff --git a/src/refs.c b/src/refs.c
index 270e7e8..0e0a491 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -173,13 +173,20 @@ static int loose_parse_oid(git_oid *oid, git_buf *file_content)
 
 	buffer = (char *)file_content->ptr;
 
-	/* File format: 40 chars (OID) */
-	if (git_buf_len(file_content) < GIT_OID_HEXSZ)
+	/* File format: 40 chars (OID) + newline */
+	if (git_buf_len(file_content) < GIT_OID_HEXSZ + 1)
 		goto corrupt;
 
 	if (git_oid_fromstr(oid, buffer) < 0)
 		goto corrupt;
 
+	buffer = buffer + GIT_OID_HEXSZ;
+	if (*buffer == '\r')
+		buffer++;
+
+	if (*buffer != '\n')
+		goto corrupt;
+
 	return 0;
 
 corrupt: