Fixed a bug in the dev_read_memory command

This commit is contained in:
2020-01-10 14:35:00 -05:00
parent 27a46c38d1
commit 8c5c5a8976
2 changed files with 5 additions and 1 deletions

View File

@@ -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)

View File

@@ -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);
}