From 0586215662320139dc1f5363dce7da3522463f91 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Fri, 20 Apr 2012 02:23:14 +0200 Subject: [PATCH] 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. --- src/tree-cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- 2.39.5