mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
added some sanity checks for the person who enters too small blocksize
This commit is contained in:
parent
f563f461d9
commit
0607f3a47b
1 changed files with 26 additions and 0 deletions
|
@ -1250,6 +1250,12 @@ static int CmdHF15ESave(const char *Cmd) {
|
|||
int count = arg_get_int_def(ctx, 3, -1);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
// sanity checks
|
||||
if (blocksize < 4) {
|
||||
PrintAndLogEx(WARNING, "Blocksize too small, using default 4 bytes");
|
||||
blocksize = 4;
|
||||
}
|
||||
|
||||
int bytes = CARD_MEMORY_SIZE;
|
||||
if (count > 0 && count * blocksize <= bytes) {
|
||||
bytes = count * blocksize;
|
||||
|
@ -1703,6 +1709,11 @@ static int CmdHF15Dump(const char *Cmd) {
|
|||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
if (blocksize < 4) {
|
||||
PrintAndLogEx(WARNING, "Blocksize too small, using default 4 bytes");
|
||||
blocksize = 4;
|
||||
}
|
||||
|
||||
// default fallback to scan for tag.
|
||||
// overriding unaddress parameter :)
|
||||
if (uidlen != HF15_UID_LENGTH) {
|
||||
|
@ -2054,6 +2065,11 @@ static int CmdHF15Readmulti(const char *Cmd) {
|
|||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
if (blocksize < 4) {
|
||||
PrintAndLogEx(WARNING, "Blocksize too small, using default 4 bytes");
|
||||
blocksize = 4;
|
||||
}
|
||||
|
||||
// enforcing add_option in order to get lock-info
|
||||
if (add_option == false) {
|
||||
if (verbose) {
|
||||
|
@ -2201,6 +2217,11 @@ static int CmdHF15Readblock(const char *Cmd) {
|
|||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
if (blocksize < 4) {
|
||||
PrintAndLogEx(WARNING, "Blocksize too small, using default 4 bytes");
|
||||
blocksize = 4;
|
||||
}
|
||||
|
||||
// enforcing add_option in order to get lock-info
|
||||
if (add_option == false) {
|
||||
if (verbose) {
|
||||
|
@ -2499,6 +2520,11 @@ static int CmdHF15Restore(const char *Cmd) {
|
|||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
if (blocksize < 4) {
|
||||
PrintAndLogEx(WARNING, "Blocksize too small, using default 4 bytes");
|
||||
blocksize = 4;
|
||||
}
|
||||
|
||||
// default fallback to scan for tag.
|
||||
// overriding unaddress parameter :)
|
||||
if (uidlen != HF15_UID_LENGTH) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue