summaryrefslogtreecommitdiff
path: root/src/tree.c
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2011-04-09 15:22:11 -0700
committerVicent Marti <tanoku@gmail.com>2011-04-09 15:22:11 -0700
commitc6e65acae63bd9b251140184679ab4ea0ec5c1a9 (patch)
tree42e304af6ea9be7f4f35e3beca314fccc9fddd27 /src/tree.c
parentb918ae40d1dc5116d7631ef822d7b5b39a622c81 (diff)
downloadlibgit2-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.c3
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;