From 393d998ad95ec3a0460c144e89176b2bc4b67385 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Thu, 5 Mar 2020 11:27:42 +0100 Subject: [PATCH] fix downloading lf config --- armsrc/appmain.c | 6 ++---- client/cmdlf.c | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/armsrc/appmain.c b/armsrc/appmain.c index 88c85ad57..1c76fad7d 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -726,10 +726,8 @@ static void PacketReceived(PacketCommandNG *packet) { break; } case CMD_LF_SAMPLING_GET_CONFIG: { - sample_config *c; - c = getSamplingConfig(); - Dbprintf("CMD_LF_SAMPLING_GET_CONFIG - before answer"); - reply_ng(CMD_LF_SAMPLING_GET_CONFIG, PM3_SUCCESS, (uint8_t *)c, sizeof(sample_config)); + sample_config *config = getSamplingConfig(); + reply_ng(CMD_LF_SAMPLING_GET_CONFIG, PM3_SUCCESS, (uint8_t *)config, sizeof(sample_config)); break; } case CMD_LF_SAMPLING_SET_CONFIG: { diff --git a/client/cmdlf.c b/client/cmdlf.c index c44764fd0..7fa73818d 100644 --- a/client/cmdlf.c +++ b/client/cmdlf.c @@ -471,8 +471,7 @@ int lf_getconfig(sample_config *config) { PrintAndLogEx(WARNING, "command execution time out"); return PM3_ETIMEOUT; } - - config = (sample_config *) resp.data.asBytes; + memcpy(config, resp.data.asBytes, sizeof(sample_config)); return PM3_SUCCESS; }