Commit 4aaae9354cd12cdd2658696b2506b02fa584e776

Edward Thomson 2016-07-22T12:53:13

index: cast to avoid warning

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/src/index.c b/src/index.c
index 6546ea1..9908ba6 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) {