data diff now handles file sizes up to 4096 bytes

This commit is contained in:
iceman1001 2024-01-29 18:57:19 +01:00
commit 5a828bd6a8
2 changed files with 10 additions and 6 deletions

View file

@ -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]
- Changed `lf hitag dump --ns` - now support nosave flag (@iceman1001)
- Added `hf xerox rdbl` - read block of a Fuji/Xerox tag (@iceman1001)
- Added a xerox trace file, thanks @jeroenSteen, (@iceman1001)
- Fixed `lf em 4x05 view` - now loads JSON files properl (@iceman1001)

View file

@ -3132,10 +3132,13 @@ static int CmdDiff(const char *Cmd) {
int res = PM3_SUCCESS;
uint8_t *inA = NULL, *inB = NULL;
size_t datalenA = 0, datalenB = 0;
// read file A
if (fnlenA) {
// read dump file
res = pm3_load_dump(filenameA, (void **)&inA, &datalenA, 2048);
res = pm3_load_dump(filenameA, (void **)&inA, &datalenA, MIFARE_4K_MAX_BYTES);
if (res != PM3_SUCCESS) {
return res;
}
@ -3144,7 +3147,7 @@ static int CmdDiff(const char *Cmd) {
// read file B
if (fnlenB) {
// read dump file
res = pm3_load_dump(filenameB, (void **)&inB, &datalenB, 2048);
res = pm3_load_dump(filenameB, (void **)&inB, &datalenB, MIFARE_4K_MAX_BYTES);
if (res != PM3_SUCCESS) {
return res;
}
@ -3169,14 +3172,14 @@ static int CmdDiff(const char *Cmd) {
// download emulator memory
if (use_e) {
uint8_t *d = calloc(4096, sizeof(uint8_t));
uint8_t *d = calloc(MIFARE_4K_MAX_BYTES, sizeof(uint8_t));
if (d == NULL) {
PrintAndLogEx(WARNING, "Fail, cannot allocate memory");
return PM3_EMALLOC;
}
PrintAndLogEx(INFO, "downloading from emulator memory");
if (GetFromDevice(BIG_BUF_EML, d, 4096, 0, NULL, 0, NULL, 2500, false) == false) {
if (GetFromDevice(BIG_BUF_EML, d, MIFARE_4K_MAX_BYTES, 0, NULL, 0, NULL, 2500, false) == false) {
PrintAndLogEx(WARNING, "Fail, transfer from device time-out");
free(inA);
free(inB);
@ -3185,10 +3188,10 @@ static int CmdDiff(const char *Cmd) {
}
if (fnlenA) {
datalenB = 4096;
datalenB = MIFARE_4K_MAX_BYTES;
inB = d;
} else {
datalenA = 4096;
datalenA = MIFARE_4K_MAX_BYTES;
inA = d;
}
}