RfidResearchGroup / proxmark3

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

Fix hf sniff #2267

Closed nvx closed 5 months ago

nvx commented 5 months ago

This was broken in commit 17ab86c52 as the forced rounding up of the size to 4-byte alignment in BigBuf_malloc made the size check possibly larger than the buffer size as the check was always +3 on the requested size rather than the rounded size. This was made worse by BigBuf_max_traceLen not taking into account alignment either and the alignmentn check in hfsnoop.c checking to 2 byte alignment instead of 4 byte alignment.

The alignment size check now checks the size after alignment rounding, and BigBuf_max_traceLen takes into account alignment losses too reducing the need for BigBuf consumers to have to care about alignment.

nvx commented 5 months ago

As a side effect this may fix other unrelated uses of BigBuf too (I never tested lf sniff but I wouldn't be surprised if it had the same issue)

iceman1001 commented 5 months ago

Great catch,

Lets see if its fixing why hf emrtd commands fails.