Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mf file loading error #2155

Merged
merged 1 commit into from
Oct 30, 2023
Merged

Conversation

henrygab
Copy link
Contributor

The code was incorrectly checking the loop variable i,
rather than checking the used data length / current buffer pointer.

This causes dumps with all 64 sectors of data to refuse to load, with false error message that the data buffer size was exceeeded.

Also improved flow for dump files, by providing distinct error message when a data block in the JSON ...

  • ... would exceed maximum total data size
  • ... has zero data
  • ... has fewer than 16 bytes of data

Bonus fix for that third case (< 16 bytes):

The old code would save the partial-block into the buffer ... but all future blocks of data would then be loaded at an incorrect offset. The fixed code ensures zero-filled data is used, and this is noticable at the client via the warning message.

Code was incorrectly checking if loop variable
`i` was greater than maximum data length,
rather than checking current buffer pointer.
@github-actions
Copy link

You are welcome to add an entry to the CHANGELOG.md as well

@iceman1001 iceman1001 merged commit b50b405 into RfidResearchGroup:master Oct 30, 2023
11 checks passed
@iceman1001
Copy link
Collaborator

Nice catches!

Something makes me believe that more json loading parts could use your fixes...

@henrygab henrygab deleted the mf_dump_fix branch October 30, 2023 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants