RfidResearchGroup / proxmark3

Iceman Fork - Proxmark3
http://www.icedev.se
GNU General Public License v3.0
3.89k stars 1.03k forks source link

CMD_READ_MEM_DOWNLOADED cannot send from address 0 #2266

Closed martian closed 8 months ago

martian commented 8 months ago

Describe the bug hw readmem/--dumpmem cannot send data from address 0 in raw mode

To Reproduce ./pm3 -c 'hw readmem -r -a 0'

Expected behavior [=] 00 | 06 00 00 EA 14 00 00 EA 14 00 00 EA 14 00 00 EA 14 00 00 EA FE FF FF EA 20 FF 1F E5 12 00 00 EA |

Actual behaviour [=] 00 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |

Additional context This is caused by reply_old() not allowing 0 as a data address.

martian commented 8 months ago

As this is a minor issue, this bug can be left unfixed but documented.

A specific fix is to change the data && len test in reply_old() to ((data != NULL || cmd == CMD_READ_MEM_DOWNLOADED) && len != 0)

A special case could be added in the CMD_READ_MEM_DOWNLOADED handler but that would increase bootloader size more than this is worth.

Removing the data && len test would fix it too but slightly change the behaviour of reply_old(), which other callers may not expect.