mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-22 14:23:50 -07:00
fix print_buffer out-of-boundaries bug
This commit is contained in:
parent
97eaab27a1
commit
415dd84a8d
1 changed files with 3 additions and 1 deletions
|
@ -208,7 +208,9 @@ void print_buffer(const uint8_t *data, const size_t len, int level) {
|
||||||
char buf[UTIL_BUFFER_SIZE_SPRINT + 3];
|
char buf[UTIL_BUFFER_SIZE_SPRINT + 3];
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < len; i += 16) {
|
for (i = 0; i < len; i += 16) {
|
||||||
|
if (len - i < 16) { // incomplete block, will be treated out of the loop
|
||||||
|
break;
|
||||||
|
}
|
||||||
// (16 * 3) + (16) + + 1
|
// (16 * 3) + (16) + + 1
|
||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
sprintf(buf, "%*s%02x: ", (level * 4), " ", i);
|
sprintf(buf, "%*s%02x: ", (level * 4), " ", i);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue