File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -32,13 +32,23 @@ int git_hash_sha256_init(git_hash_sha256_ctx *ctx)
32
32
return 0 ;
33
33
}
34
34
35
- int git_hash_sha256_update (git_hash_sha256_ctx * ctx , const void * data , size_t len )
35
+ int git_hash_sha256_update (git_hash_sha256_ctx * ctx , const void * _data , size_t len )
36
36
{
37
+ const unsigned char * data = _data ;
37
38
GIT_ASSERT_ARG (ctx );
38
- if (SHA256Input (& ctx -> c , data , len )) {
39
- git_error_set (GIT_ERROR_SHA , "SHA256 error" );
40
- return -1 ;
39
+
40
+ while (len > 0 ) {
41
+ unsigned int chunk = (len > UINT_MAX ) ? UINT_MAX : (unsigned int )len ;
42
+
43
+ if (SHA256Input (& ctx -> c , data , chunk )) {
44
+ git_error_set (GIT_ERROR_SHA , "SHA256 error" );
45
+ return -1 ;
46
+ }
47
+
48
+ data += chunk ;
49
+ len -= chunk ;
41
50
}
51
+
42
52
return 0 ;
43
53
}
44
54
You can’t perform that action at this time.
0 commit comments