mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 10:37:23 -07:00
Merge pull request #2265 from martian/readmem-small-fixes
Readmem small fixes
This commit is contained in:
commit
e6e9be84fb
4 changed files with 11 additions and 7 deletions
|
@ -2393,6 +2393,9 @@ static void PacketReceived(PacketCommandNG *packet) {
|
|||
} else {
|
||||
// Allow reading from any memory address and length in special 'raw' mode.
|
||||
base = NULL;
|
||||
// Boundary check against end of addressable space.
|
||||
if (offset > 0)
|
||||
count=MIN(count, -offset);
|
||||
}
|
||||
|
||||
if (isok) {
|
||||
|
|
|
@ -186,6 +186,9 @@ static void UsbPacketReceived(uint8_t *packet) {
|
|||
} else {
|
||||
// Allow reading from any memory address and length in special 'raw' mode.
|
||||
base = NULL;
|
||||
// Boundary check against end of addressable space.
|
||||
if (offset > 0)
|
||||
count=MIN(count, -offset);
|
||||
}
|
||||
|
||||
if (isok) {
|
||||
|
|
|
@ -640,10 +640,10 @@ static int CmdReadmem(const char *Cmd) {
|
|||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
arg_int0("a", "adr", "<dec>", "flash address to start reading from"),
|
||||
arg_int0("l", "len", "<dec>", "length (default 32 or 512KB)"),
|
||||
arg_u64_0("a", "adr", "<dec>", "flash address to start reading from"),
|
||||
arg_u64_0("l", "len", "<dec>", "length (default 32 or 512KB)"),
|
||||
arg_str0("f", "file", "<fn>", "save to file"),
|
||||
arg_int0("c", "cols", "<dec>", "column breaks"),
|
||||
arg_u64_0("c", "cols", "<dec>", "column breaks"),
|
||||
arg_lit0("r", "raw", "use raw address mode: read from anywhere, not just flash"),
|
||||
arg_param_end
|
||||
};
|
||||
|
@ -682,7 +682,6 @@ static int CmdReadmem(const char *Cmd) {
|
|||
}
|
||||
|
||||
if (save_to_file) {
|
||||
PrintAndLogEx(INFO, "saving to "_YELLOW_("%s"), filename);
|
||||
saveFile(filename, ".bin", buffer, len);
|
||||
} else {
|
||||
PrintAndLogEx(INFO, "---- " _CYAN_("processor%s memory") " ----", flash_str);
|
||||
|
|
|
@ -683,7 +683,6 @@ static int dumpmem_to_file(const char *filename, uint32_t addr, uint32_t len, bo
|
|||
}
|
||||
|
||||
if (res == PM3_SUCCESS) {
|
||||
PrintAndLogEx(INFO, "saving to "_YELLOW_("%s"), filename);
|
||||
if (saveFile(filename, ".bin", buffer, read) != 0) {
|
||||
PrintAndLogEx(ERR, "error writing to file "_YELLOW_("%s"), filename);
|
||||
res = PM3_EFILE;
|
||||
|
@ -1139,7 +1138,7 @@ int main(int argc, char *argv[]) {
|
|||
show_help(false, exec_name);
|
||||
return 1;
|
||||
}
|
||||
uint32_t tmpaddr = strtol(argv[i + 1], NULL, 10);
|
||||
uint32_t tmpaddr = strtoul(argv[i + 1], NULL, 0);
|
||||
dumpmem_addr = tmpaddr;
|
||||
i++;
|
||||
continue;
|
||||
|
@ -1150,7 +1149,7 @@ int main(int argc, char *argv[]) {
|
|||
show_help(false, exec_name);
|
||||
return 1;
|
||||
}
|
||||
uint32_t tmplen = strtol(argv[i + 1], NULL, 10);
|
||||
uint32_t tmplen = strtoul(argv[i + 1], NULL, 0);
|
||||
dumpmem_len = tmplen;
|
||||
i++;
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue