From 3e39689b6e0000dd191d1f12d96c1b399fd3f9ef Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Tue, 7 Sep 2021 10:04:01 +0200 Subject: [PATCH] Fix #1499 hf 15 restore and fix trace list -t 15 writeblock --- CHANGELOG.md | 1 + client/src/cmdhf15.c | 2 +- client/src/cmdhflist.c | 8 +++++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9913bb9f9..40108e7c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] + - Fix `hf 15 restore` write command and `trace list -t 15` write command (@doegox) - Changed default standalone mode to LF_SAMYRUN (@iceman1001) - Add MIFARE Plus SL3 mode traces (@iceman1001) - Fix PAC/Stanley checksum calculation (@rknoll) diff --git a/client/src/cmdhf15.c b/client/src/cmdhf15.c index b74e4bc3d..808dc2395 100644 --- a/client/src/cmdhf15.c +++ b/client/src/cmdhf15.c @@ -2028,7 +2028,7 @@ static int CmdHF15Restore(const char *Cmd) { uint16_t i = 0; while (bytes < datalen) { - req[reqlen + 1] = i; + req[reqlen] = i; // copy over the data to the request memcpy(req + reqlen + 1, data + bytes, blocksize); AddCrc15(req, reqlen + 1 + blocksize); diff --git a/client/src/cmdhflist.c b/client/src/cmdhflist.c index 24ad20f3e..038d0b50a 100644 --- a/client/src/cmdhflist.c +++ b/client/src/cmdhflist.c @@ -470,10 +470,10 @@ void annotateIso15693(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) { case ISO15693_READBLOCK: { uint8_t block = 0; - if (cmdsize == 13) - block = cmd[10]; - else if (cmdsize == 5) + if (cmdsize == 5) block = cmd[2]; + else if (cmdsize == 13) // with UID + block = cmd[10]; snprintf(exp, size, "READBLOCK(%d)", block); return; @@ -482,6 +482,8 @@ void annotateIso15693(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) { uint8_t block = 0; if (cmdsize == 9) block = cmd[2]; + else if (cmdsize == 9 + 8) // with UID + block = cmd[2 + 8]; snprintf(exp, size, "WRITEBLOCK(%d)", block); return; }