diff options
author | Scott J. Goldman <scottjg@github.com> | 2013-01-22 02:45:43 +0400 |
---|---|---|
committer | Scott J. Goldman <scottjg@github.com> | 2013-01-22 02:46:28 +0400 |
commit | 28b1cdf3a1bdcd37cf9d550c92b8c19b1782ea6b (patch) | |
tree | 620e3eb0d4d3410c6279bac46e40ceef818fc446 /src/refs.c | |
parent | d47c6aabfe8301577a6e4067aacd9ed6782e4035 (diff) |
Handle packed peeled objects without trailing newlines
Fixes #1262
Diffstat (limited to 'src/refs.c')
-rw-r--r-- | src/refs.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/refs.c b/src/refs.c index 4934a0309..4ecc628ee 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,13 @@ static int packed_parse_peel( if (*buffer == '\r') buffer++; - if (*buffer != '\n') + if (*buffer == '\n') + buffer++; + + if (buffer != buffer_end) goto corrupt; - *buffer_out = buffer + 1; + *buffer_out = buffer; return 0; corrupt: |