mirror of
https://github.com/mtrojnar/osslsigncode.git
synced 2025-04-05 01:00:11 -05:00
fix pe_calc_checksum bufor
revert part of 45fedd9e501a44f9fdbb6e702a94168e400970fc
This commit is contained in:
parent
4731667c35
commit
b48458499b
@ -1780,10 +1780,11 @@ static int set_indirect_data_blob(PKCS7 *sig, BIO *hash, file_type_t type,
|
||||
static uint32_t pe_calc_checksum(BIO *bio, FILE_HEADER *header)
|
||||
{
|
||||
uint32_t checkSum = 0, size = 0;
|
||||
static u_char buf[65536]; /* 2^16 */
|
||||
unsigned short *buf;
|
||||
int nread;
|
||||
|
||||
/* recalculate the checksum */
|
||||
buf = OPENSSL_malloc(65536); /* 2^16 */
|
||||
(void)BIO_seek(bio, 0);
|
||||
while ((nread = BIO_read(bio, buf, 65536)) > 0) {
|
||||
unsigned short val;
|
||||
@ -1797,6 +1798,7 @@ static uint32_t pe_calc_checksum(BIO *bio, FILE_HEADER *header)
|
||||
size += 2;
|
||||
}
|
||||
}
|
||||
OPENSSL_free(buf);
|
||||
checkSum = 0xffff & (checkSum + (checkSum >> 0x10));
|
||||
checkSum += size;
|
||||
return checkSum;
|
||||
|
Loading…
x
Reference in New Issue
Block a user