Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott J. Goldman <scottjg@github.com>2013-01-23 03:49:51 +0400
committerScott J. Goldman <scottjg@github.com>2013-01-23 03:49:51 +0400
commitcb35094be3c1dbe369454118e801e703d70c4a33 (patch)
tree39b48c5a56d0d0954c47394ebea1ea999e359171 /src/refs.c
parent2a707d0e24e206666626ae858e5ba618ffef0547 (diff)
Allow peeled references without trailing newline at end of file
Also ammends one of the tag tests to make sure it's working.
Diffstat (limited to 'src/refs.c')
-rw-r--r--src/refs.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/refs.c b/src/refs.c
index 4934a0309..52e0adac6 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -328,7 +328,7 @@ static int packed_parse_peel(
if (git__prefixcmp(tag_ref->name, GIT_REFS_TAGS_DIR) != 0)
goto corrupt;
- if (buffer + GIT_OID_HEXSZ >= buffer_end)
+ if (buffer + GIT_OID_HEXSZ > buffer_end)
goto corrupt;
/* Is this a valid object id? */
@@ -339,10 +339,14 @@ static int packed_parse_peel(
if (*buffer == '\r')
buffer++;
- if (*buffer != '\n')
- goto corrupt;
+ if (buffer != buffer_end) {
+ if (*buffer == '\n')
+ buffer++;
+ else
+ goto corrupt;
+ }
- *buffer_out = buffer + 1;
+ *buffer_out = buffer;
return 0;
corrupt: