From 8c5c5a897687e55808f486a3b7830f436cd84dbe Mon Sep 17 00:00:00 2001 From: Gregor Haas Date: Fri, 10 Jan 2020 14:35:00 -0500 Subject: [PATCH] Fixed a bug in the dev_read_memory command --- CMakeLists.txt | 2 ++ c8_remote/src/command.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a553ac4..089db8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,5 +3,7 @@ project(checkm8_tool) enable_language(C) include_directories(include) + +#add_subdirectory(c8_arduino) add_subdirectory(c8_remote) add_subdirectory(c8_payloads) diff --git a/c8_remote/src/command.c b/c8_remote/src/command.c index f814f39..a905e2a 100644 --- a/c8_remote/src/command.c +++ b/c8_remote/src/command.c @@ -228,10 +228,12 @@ struct dev_cmd_resp *dev_read_memory(struct pwned_device *dev, long long addr, i resp = command(dev, (unsigned char *) &cmd_args, 5 * sizeof(unsigned long long), 16 + amount); ret->ret = resp->ret; + ret->retval = resp->retval; if(IS_CHECKM8_FAIL(resp->ret)) { checkm8_debug_indent("\tlast transfer failed, aborting\n"); + free_dev_cmd_resp(resp); free(ret->data); ret->data = NULL; @@ -240,7 +242,7 @@ struct dev_cmd_resp *dev_read_memory(struct pwned_device *dev, long long addr, i else { checkm8_debug_indent("\tsuccessfully copied chunk\n"); - memcpy(&ret->data[index], &resp->data[8], amount); + memcpy(&ret->data[index], resp->data, amount); free_dev_cmd_resp(resp); }