summaryrefslogtreecommitdiff
path: root/src/index.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@github.com>2016-08-02 18:43:12 -0400
committerGitHub <noreply@github.com>2016-08-02 18:43:12 -0400
commit152efee20b74ea261cf8e05410a110687e17376e (patch)
treefbeeb809f3e7fd64d38a647a14ce331a5f5aeba5 /src/index.c
parenta37624ecc7e8949ed9013af3bcb974f510720316 (diff)
parentdf87648ab87f99a7cc53bdabc8aceb01e6771dac (diff)
downloadlibgit2-152efee20b74ea261cf8e05410a110687e17376e.tar.gz
Merge pull request #3865 from libgit2/ethomson/leaks
Fix leaks, some warnings and an error
Diffstat (limited to 'src/index.c')
-rw-r--r--src/index.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/index.c b/src/index.c
index 6546ea18a..9908ba64b 100644
--- a/src/index.c
+++ b/src/index.c
@@ -2160,12 +2160,12 @@ static int read_reuc(git_index *index, const char *buffer, size_t size)
if (git__strtol64(&tmp, buffer, &endptr, 8) < 0 ||
!endptr || endptr == buffer || *endptr ||
- tmp < 0) {
+ tmp < 0 || tmp > UINT32_MAX) {
index_entry_reuc_free(lost);
return index_error_invalid("reading reuc entry stage");
}
- lost->mode[i] = tmp;
+ lost->mode[i] = (uint32_t)tmp;
len = (endptr + 1) - buffer;
if (size <= len) {