summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlos@cmartin.tk>2012-04-20 02:23:14 +0200
committerRussell Belfer <rb@github.com>2012-04-23 10:41:43 -0700
commit2218fd57a50ceb851cb131939bf0747e072e40f6 (patch)
tree1e0f8c5ebe0d82b4549cf0f06404676bc19d2c8c /src
parent7dbbf4d7f21b5859e24a03c6176a666edb8ef9a9 (diff)
downloadlibgit2-2218fd57a50ceb851cb131939bf0747e072e40f6.tar.gz
tree-cache: don't error out on a childless invalidated entry
The code used to assume that there had to be data after the newline in a tree cache extension entry. This isn't true for a childless invalidated entry if it's the last one, as there won't be any children nor a hash to take up space. Adapt the off-by-one comparison to also work in this case. Fixes #633.
Diffstat (limited to 'src')
-rw-r--r--src/tree-cache.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tree-cache.c b/src/tree-cache.c
index 10667b175..9baa06a99 100644
--- a/src/tree-cache.c
+++ b/src/tree-cache.c
@@ -130,7 +130,7 @@ static int read_tree_internal(git_tree_cache **out,
tree->children_count = count;
- if (*buffer != '\n' || ++buffer >= buffer_end) {
+ if (*buffer != '\n' || ++buffer > buffer_end) {
error = GIT_EOBJCORRUPTED;
goto cleanup;
}