Commit Diff


commit - faf51db5e8152629d9c4aa4672b3f26e6acecf10
commit + 5d0baf4e3f639af9dcfcde4e24f9db7aa72332c3
blob - f5c3ffa28603a655efaca764f0ff6031de2ef9f5
blob + 178e7e91153e42da5da0b4bd7591767bc0a63e21
--- lib/pack_index.c
+++ lib/pack_index.c
@@ -627,8 +627,11 @@ got_pack_index(struct got_pack *pack, int idxfd, FILE 
 	size_t mapoff = 0;
 	int p_indexed = 0, last_p_indexed = -1;
 	int p_resolved = 0, last_p_resolved = -1;
-	size_t digest_len = got_hash_digest_length(pack->algo);
+	ssize_t digest_len;
 
+	/* This has to be signed for lseek(2) later */
+	digest_len = got_hash_digest_length(pack->algo);
+
 	/* Require that pack file header and hash trailer are present. */
 	if (pack->filesize < sizeof(hdr) + digest_len)
 		return got_error_msg(GOT_ERR_BAD_PACKFILE,