From 7f49731ec6628b2ce0a091653ac2765b82c6a536 Mon Sep 17 00:00:00 2001 From: Gregor Haas Date: Wed, 8 Jan 2020 15:33:08 -0500 Subject: [PATCH] report the return value of the command --- c8_remote/include/command.h | 1 + c8_remote/src/command.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/c8_remote/include/command.h b/c8_remote/include/command.h index d19a67c..42c5f54 100644 --- a/c8_remote/include/command.h +++ b/c8_remote/include/command.h @@ -9,6 +9,7 @@ struct dev_cmd_resp { int ret; unsigned long long magic; + unsigned long long retval; unsigned char *data; int len; }; diff --git a/c8_remote/src/command.c b/c8_remote/src/command.c index 0f0c665..f814f39 100644 --- a/c8_remote/src/command.c +++ b/c8_remote/src/command.c @@ -136,14 +136,17 @@ struct dev_cmd_resp *command(struct pwned_device *dev, cmd_resp->ret = CHECKM8_SUCCESS; memcpy(&cmd_resp->magic, resp_buf, 8); + memcpy(&cmd_resp->retval, &resp_buf[8], 8); + if(response_len - 16 > 0) { checkm8_debug_indent("\tcopying %i bytes of output to response data section\n", response_len - 16); + + cmd_resp->len = response_len - 16; cmd_resp->data = calloc(1, response_len - 16); memcpy(cmd_resp->data, &resp_buf[16], response_len - 16); } - - cmd_resp->len = response_len - 16; + else cmd_resp->len = 0; if(close) close_device_session(dev); return cmd_resp;