aboutsummaryrefslogtreecommitdiff
path: root/src/SFilePatchArchives.cpp
diff options
context:
space:
mode:
authorLadislav Zezula <E:\Ladik\Mail>2015-11-17 11:34:18 +0100
committerLadislav Zezula <E:\Ladik\Mail>2015-11-17 11:34:18 +0100
commitf608c0798420fd0d7a472a831ecef00bbdf4c7f0 (patch)
tree14be04870671eebb1f70862ea2382a39a38cf729 /src/SFilePatchArchives.cpp
parentdae6c5e315445b0c25d6a500deb7e7e625d8df90 (diff)
+ Fixed possible buffer overflow in the patching process
Diffstat (limited to 'src/SFilePatchArchives.cpp')
-rw-r--r--src/SFilePatchArchives.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/SFilePatchArchives.cpp b/src/SFilePatchArchives.cpp
index 840f86c..e2c59b4 100644
--- a/src/SFilePatchArchives.cpp
+++ b/src/SFilePatchArchives.cpp
@@ -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++)