+ Fixed possible buffer overflow in the patching process

This commit is contained in:
Ladislav Zezula
2015-11-17 11:34:18 +01:00
parent dae6c5e315
commit f608c07984
2 changed files with 26 additions and 9 deletions

View File

@@ -277,6 +277,8 @@ static int ApplyFilePatch_BSD0(
// Get the longest block that we can combine
dwCombineSize = ((dwOldOffset + dwAddDataLength) >= dwOldSize) ? (dwOldSize - dwOldOffset) : dwAddDataLength;
if((dwNewOffset + dwCombineSize) > dwNewSize || (dwNewOffset + dwCombineSize) < dwNewOffset)
return ERROR_FILE_CORRUPT;
// Now combine the patch data with the original file
for(i = 0; i < dwCombineSize; i++)