diff options
| author | Vicent Marti <tanoku@gmail.com> | 2011-04-09 15:22:11 -0700 |
|---|---|---|
| committer | Vicent Marti <tanoku@gmail.com> | 2011-04-09 15:22:11 -0700 |
| commit | c6e65acae63bd9b251140184679ab4ea0ec5c1a9 (patch) | |
| tree | 42e304af6ea9be7f4f35e3beca314fccc9fddd27 /src/tree.c | |
| parent | b918ae40d1dc5116d7631ef822d7b5b39a622c81 (diff) | |
| download | libgit2-c6e65acae63bd9b251140184679ab4ea0ec5c1a9.tar.gz | |
Properly check `strtol` for errors
We are now using a custom `strtol` implementation to make sure we're not
missing any overflow errors.
Diffstat (limited to 'src/tree.c')
| -rw-r--r-- | src/tree.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/tree.c b/src/tree.c index b474d394b..64f81d780 100644 --- a/src/tree.c +++ b/src/tree.c @@ -150,7 +150,8 @@ static int tree_parse_buffer(git_tree *tree, const char *buffer, const char *buf if (git_vector_insert(&tree->entries, entry) < GIT_SUCCESS) return GIT_ENOMEM; - entry->attr = strtol(buffer, (char **)&buffer, 8); + if (git__strtol32((long *)&entry->attr, buffer, &buffer, 8) < GIT_SUCCESS) + return GIT_EOBJCORRUPTED; if (*buffer++ != ' ') { error = GIT_EOBJCORRUPTED; |
