Repository navigation
lf t55xx: fix the help text leak, dump fails on an incomplete page 0 - #3850
Merged
iceman1001 merged 3 commits intoNov 22, 2026
Merged
Conversation
arg_add_t55xx_downloadlink() allocated the help texts of --r0 to --r3 and --all with calloc() on every call. argtable keeps the pointers and never frees them, so the 16 lf t55xx commands that use the helper leaked 224 bytes per call, 280 with --all. The texts are now static buffers. lf t55xx dump saved the file only when all of page 0 was read, but returned success either way, without a message. It now prints "Page 0 not read in full" and returns PM3_ESOFT, also with --ns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Gabriele Gristina <matrix@users.noreply.github.com>
Signed-off-by: Iceman <iceman@iuse.se>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
arg_add_t55xx_downloadlink()builds the help texts of--r0to--r3and--allwithcalloc()on every call. argtable keeps the pointers and never frees them. The 16lf t55xxcommands that use the helper leak 224 bytes per call, 280 when they have--all(detect,chk,bruteforce,recoverpw).lf t55xx dumpsaves the file only when all of page 0 is read, but returnsPM3_SUCCESSeither way, without a message. With no tag it prints an empty table and exits with 0.Change
client/src/cmdlft55xx.c:arg_add_t55xx_downloadlink(): the five help texts are static buffers of 56 bytes, filled as before. They take 280 bytes for the life of the client, and the helper no longer has an allocation that can fail.CmdT55xxDump(): when a block of page 0 is not read, it printsPage 0 not read in fulland returnsPM3_ESOFT. The check comes before--ns, as inlf em 4x05 dump. The save code loses itsif (success)and moves one level left, otherwise unchanged.Behaviour change
lf t55xx dump, with or without--ns, returns an error when page 0 is not read in full.Testing
Proxmark3 RDV2 with the firmware of master 6d4ee98, the clients of master and of this branch, 3 runs per case.
-h, clients built withSANITIZE=1, 1 run--alllf t55xx detect; lf t55xx dump -f <file>on a T5577,SANITIZE=1lf t55xx detect; lf t55xx dump -f <file>on a T5577lf t55xx detect; lf t55xx dump --nson a T5577lf t55xx dump -f <file>without a tagPage 0 not read in full, exit 246 (PM3_ESOFT)lf t55xx dump --nswithout a tagPage 0 not read in full, exit 246Builds
experimental_libclients and the six platforms without warnings,make check319 passed, 0 failed, 8 skipped.make check319 passed, 0 failed, 8 skipped. The only warnings are the linker's-bind_at_load is deprecated.Not tested
Checklist
client/Makefile,client/CMakeLists.txt, andclient/experimental_lib/CMakeLists.txtall updated if client sources changed (no file added, all three built)make checkon Linux and macOS, device tests from Linuxdoc/commands.md/doc/commands.jsonleft untouched