From be493daf72c22b1760dd5d1a3ea30c2f1c9a2ae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Breno=20Dantas=20Mendon=C3=A7a?= Date: Wed, 28 Aug 2019 01:39:15 -0300 Subject: [PATCH] Update task_patch.c Fix IPS Patch, still without reallocation --- tasks/task_patch.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tasks/task_patch.c b/tasks/task_patch.c index 63fac58716..cd62a82486 100644 --- a/tasks/task_patch.c +++ b/tasks/task_patch.c @@ -180,7 +180,7 @@ static enum patch_error bps_apply_patch( uint8_t *prov=(uint8_t*)malloc((size_t)modify_target_size); if (prov!=NULL){ free(*target_data); - bps.target_data=prov; + bps.target_data=prov; *target_data=prov; bps.target_length=modify_target_size; }else @@ -433,10 +433,10 @@ static enum patch_error ups_apply_patch( static enum patch_error ips_apply_patch( const uint8_t *patchdata, uint64_t patchlen, const uint8_t *sourcedata, uint64_t sourcelength, - uint8_t **targetdata, uint64_t *targetlength) + uint8_t **targetdata_fix, uint64_t *targetlength) { uint32_t offset = 5; - + uint8_t* target_data=*target_data_fix; if (patchlen < 8 || patchdata[0] != 'P' || patchdata[1] != 'A' || @@ -445,7 +445,7 @@ static enum patch_error ips_apply_patch( patchdata[4] != 'H') return PATCH_PATCH_INVALID; - memcpy(*targetdata, sourcedata, (size_t)sourcelength); + memcpy(targetdata, sourcedata, (size_t)sourcelength); *targetlength = sourcelength; @@ -487,7 +487,7 @@ static enum patch_error ips_apply_patch( break; while (length--) - *targetdata[address++] = patchdata[offset++]; + targetdata[address++] = patchdata[offset++]; } else /* RLE */ { @@ -501,7 +501,7 @@ static enum patch_error ips_apply_patch( break; while (length--) - *targetdata[address++] = patchdata[offset]; + targetdata[address++] = patchdata[offset]; offset++; }