From f0b93405fa12299c37d86db8d566dc246c266dda Mon Sep 17 00:00:00 2001 From: douniwan5788 Date: Wed, 27 Nov 2024 00:01:15 +0800 Subject: [PATCH] fix Hitag S concatbits and `lf em 410x clone --hts` --- client/src/cmdlfem410x.c | 1 + common/commonutil.c | 4 ++-- include/hitag.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/client/src/cmdlfem410x.c b/client/src/cmdlfem410x.c index ebcd9ee8cc..10ad41369c 100644 --- a/client/src/cmdlfem410x.c +++ b/client/src/cmdlfem410x.c @@ -732,6 +732,7 @@ static int CmdEM410xClone(const char *Cmd) { packet.cmd = HTSF_82xx; memcpy(packet.pwd, "\xBB\xDD\x33\x99", HITAGS_PAGE_SIZE); + packet.mode = HITAGS_UID_REQ_FADV; SendCommandNG(CMD_LF_HITAGS_WRITE, (uint8_t *)&packet, sizeof(packet)); if (WaitForResponseTimeout(CMD_LF_HITAGS_WRITE, &resp, 4000) == false) { PrintAndLogEx(WARNING, "timeout while waiting for reply."); diff --git a/common/commonutil.c b/common/commonutil.c index ad867be866..7ed34067f3 100644 --- a/common/commonutil.c +++ b/common/commonutil.c @@ -554,8 +554,8 @@ size_t concatbits(uint8_t *dest, int dest_offset, const uint8_t *src, int src_of end = nbits; step = 1; } else { - i = nbits; - end = 0; + i = nbits - 1; + end = -1; step = -1; } diff --git a/include/hitag.h b/include/hitag.h index 451952ce48..e63b8c448d 100644 --- a/include/hitag.h +++ b/include/hitag.h @@ -161,7 +161,7 @@ typedef struct { uint8_t logdata_1[4]; uint8_t nonce[4]; - //Hitag s section + // Hitag S section uint8_t mode; } PACKED lf_hitag_data_t;