Soft-Patch any IPS size (put declarations at beginning)

This commit is contained in:
brenodantas10 2019-09-01 18:44:21 -03:00
parent 49032ae2f2
commit 0ab26a1371

View File

@ -435,9 +435,9 @@ static enum patch_error ips_alloc_targetdata(
uint64_t sourcelength, uint64_t sourcelength,
uint8_t **targetdata, uint64_t *targetlength) uint8_t **targetdata, uint64_t *targetlength)
{ {
*targetlength = sourcelength;
uint8_t *prov_alloc; uint8_t *prov_alloc;
uint32_t offset = 5; uint32_t offset = 5;
*targetlength = sourcelength;
for (;;) for (;;)
{ {
@ -524,6 +524,7 @@ static enum patch_error ips_apply_patch(
uint8_t **targetdata, uint64_t *targetlength) uint8_t **targetdata, uint64_t *targetlength)
{ {
uint32_t offset = 5; uint32_t offset = 5;
enum patch_error error_patch = PATCH_UNKNOWN;
if (patchlen < 8 || if (patchlen < 8 ||
patchdata[0] != 'P' || patchdata[0] != 'P' ||
patchdata[1] != 'A' || patchdata[1] != 'A' ||
@ -532,9 +533,9 @@ static enum patch_error ips_apply_patch(
patchdata[4] != 'H') patchdata[4] != 'H')
return PATCH_PATCH_INVALID; return PATCH_PATCH_INVALID;
enum patch_error error_patch = ips_alloc_targetdata( patchdata, patchlen, error_patch = ips_alloc_targetdata( patchdata, patchlen,
sourcelength, targetdata, sourcelength, targetdata,
targetlength); targetlength);
if ( error_patch != PATCH_SUCCESS) if ( error_patch != PATCH_SUCCESS)
return error_patch; return error_patch;