diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2012-12-12 19:23:05 +0700 |
---|---|---|
committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2012-12-12 19:23:05 +0700 |
commit | 08f3d6caf4bc1e3695e04c85f1f7d3d0a4dd1554 (patch) | |
tree | 413c8e00d8b2a8c4267411fdf4c81cf6710492c6 /src/tree-cache.c | |
parent | 8d13035e0d99de80222ea9a2580de04692288007 (diff) | |
download | libgit2-08f3d6caf4bc1e3695e04c85f1f7d3d0a4dd1554.tar.gz |
tree cache: loosen negative entry count check
While C Git has been writing entry count -1 (ie. never other negative
numbers) as invalid since day 1, it accepts all negative entry counts
as invalid. JGit follows the same rule. libgit2 should also follow, or
the index that works with C Git or JGit may someday be rejected by
libgit2.
Other reimplementations like dulwich and grit have not bothered with
parsing or writing tree cache.
Diffstat (limited to 'src/tree-cache.c')
-rw-r--r-- | src/tree-cache.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tree-cache.c b/src/tree-cache.c index 8d186d2fb..d6ecfbcee 100644 --- a/src/tree-cache.c +++ b/src/tree-cache.c @@ -104,7 +104,7 @@ static int read_tree_internal(git_tree_cache **out, tree->name[name_len] = '\0'; /* Blank-terminated ASCII decimal number of entries in this tree */ - if (git__strtol32(&count, buffer, &buffer, 10) < 0 || count < -1) + if (git__strtol32(&count, buffer, &buffer, 10) < 0) goto corrupted; tree->entries = count; |