memzap

replay memory writes
git clone git://git.2f30.org/memzap
Log | Files | Refs | README | LICENSE

commit fd0d7bc2bffa40a376fd4def7148de03a27a6b25
parent fdcc971d1dc2e851e4a50eae1f3424d68f00b351
Author: sin <sin@2f30.org>
Date:   Fri,  1 Mar 2013 12:13:00 +0000

memzap: No need to use extra pointers here

Diffstat:
Mmemzap.c | 12+++++-------
1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/memzap.c b/memzap.c @@ -40,7 +40,7 @@ main(int argc, char *argv[]) struct mem_region_diff *rdiff; int ret, stat; pid_t pid; - unsigned char *buf, *buf_new, *pold, *pnew; + unsigned char *buf, *buf_new; char *addr; size_t len; @@ -100,12 +100,10 @@ main(int argc, char *argv[]) if (!WIFSTOPPED(stat)) goto out_mmap; - pold = buf; - pnew = buf_new; do { - readmem(pid, pold, (off_t)addr, len); + readmem(pid, buf, (off_t)addr, len); - mr_old = build_mem_region(pold, len); + mr_old = build_mem_region(buf, len); if (!mr_old) errx(1, "[-] Failed to build memory region\n"); mt_old = build_mem_tree(mr_old); @@ -123,9 +121,9 @@ main(int argc, char *argv[]) goto out_mmap; } - readmem(pid, pnew, (off_t)addr, len); + readmem(pid, buf_new, (off_t)addr, len); - mr_new = build_mem_region(pnew, len); + mr_new = build_mem_region(buf_new, len); if (!mr_new) errx(1, "[-] Failed to build memory region\n"); rdiff = diff_mem_region(mt_old, mr_new);