Commit Diff


commit - 8193d041d9f06ea7e99fa60f48a738cea4991644
commit + dd4ea8bd9bd04c88bb85c1b7f67a7f7b3e43b94e
blob - b253e5ac03dea40d28e1f2112418a29f0365a7c6
blob + 10b18441dcd85ef135b54279beb0f68f297be850
--- libexec/got-fetch-pack/got-fetch-pack.c
+++ libexec/got-fetch-pack/got-fetch-pack.c
@@ -688,7 +688,8 @@ fetch_pack(int fd, int packfd, uint8_t *pack_sha1,
 				while (sha1_buf_len > 0 &&
 				    sha1_buf_len + r > SHA1_DIGEST_LENGTH) {
 					SHA1Update(&sha1_ctx, sha1_buf, 1);
-					memmove(sha1_buf, sha1_buf + 1, 1);
+					memmove(sha1_buf, sha1_buf + 1,
+					    sha1_buf_len - 1);
 					sha1_buf_len--;
 				}