Skip to content

Commit 492e505

Browse files
authored
Merge pull request #1458 from val-ms/CLAM-2696-ole2-decrypt-overread
Fix bounds check in OLE2 decryption
2 parents 1f214b2 + e62b5e8 commit 492e505

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libclamav/ole2_extract.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2130,7 +2130,7 @@ static cl_error_t handler_otf_encrypted(ole2_header_t *hdr, property_t *prop, co
21302130
}
21312131
bytesRead += blockSize;
21322132

2133-
for (; writeIdx <= (leftover + bytesToWrite) - 16; writeIdx += 16, decryptDstIdx += 16) {
2133+
for (; writeIdx + 16 <= leftover + bytesToWrite; writeIdx += 16, decryptDstIdx += 16) {
21342134
rijndaelDecrypt(rk, nrounds, &(buff[writeIdx]), &(decryptDst[decryptDstIdx]));
21352135
}
21362136

0 commit comments

Comments
 (0)