... | ... |
@@ -2457,7 +2457,21 @@ int cli_scanpe(cli_ctx *ctx) |
2457 | 2457 |
|
2458 | 2458 |
for(i = 0 ; i < nsections; i++) { |
2459 | 2459 |
if(exe_sections[i].raw) { |
2460 |
- if(!exe_sections[i].rsz || (unsigned int)fmap_readn(map, dest + exe_sections[i].rva - min, exe_sections[i].raw, exe_sections[i].ursz) != exe_sections[i].ursz) { |
|
2460 |
+ unsigned int r_ret; |
|
2461 |
+ |
|
2462 |
+ if (!exe_sections[i].rsz) |
|
2463 |
+ goto out_no_petite; |
|
2464 |
+ |
|
2465 |
+ if (!CLI_ISCONTAINED(dest, dsize, |
|
2466 |
+ dest + exe_sections[i].rva - min, |
|
2467 |
+ exe_sections[i].ursz)) |
|
2468 |
+ goto out_no_petite; |
|
2469 |
+ |
|
2470 |
+ r_ret = fmap_readn(map, dest + exe_sections[i].rva - min, |
|
2471 |
+ exe_sections[i].raw, |
|
2472 |
+ exe_sections[i].ursz); |
|
2473 |
+ if (r_ret != exe_sections[i].ursz) { |
|
2474 |
+out_no_petite: |
|
2461 | 2475 |
free(exe_sections); |
2462 | 2476 |
free(dest); |
2463 | 2477 |
return CL_CLEAN; |