diff options
| author | Russell Belfer <rb@github.com> | 2013-01-22 16:02:43 -0800 |
|---|---|---|
| committer | Russell Belfer <rb@github.com> | 2013-01-22 16:02:43 -0800 |
| commit | 8958fad77078643211c2eb14ea1d94ce4780a197 (patch) | |
| tree | 0f56e5c4135d45a12885678520da4d8433359cad /src | |
| parent | f0f073b740f0fa9f4d090f237b4667a92e4d5d74 (diff) | |
| parent | 5c7b77c4f8707571530fc2b2c3b7154965a27344 (diff) | |
| download | libgit2-8958fad77078643211c2eb14ea1d94ce4780a197.tar.gz | |
Merge pull request #1270 from libgit2/packed-peeled-objects-fix
Allow peeled references without trailing newline at end of file
Diffstat (limited to 'src')
| -rw-r--r-- | src/refs.c | 12 |
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: |
