mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-03-22 21:17:31 +08:00
fix overflow in print hex
This commit is contained in:
parent
009b91e096
commit
9407be8ea8
1 changed files with 2 additions and 1 deletions
|
@ -189,7 +189,8 @@ void hex_to_buffer(uint8_t *buf, const uint8_t *hex_data, const size_t hex_len,
|
|||
size_t max_len = (hex_len > hex_max_len) ? hex_max_len : hex_len;
|
||||
|
||||
size_t i;
|
||||
for (i = 0; i < max_len; ++i, tmp += 2 + spaces_between) {
|
||||
for (i = 0; i < max_len && (tmp - tmp_base); ++i, tmp += 2 + spaces_between) {
|
||||
|
||||
snprintf(tmp, hex_max_len - (tmp - tmp_base), (uppercase) ? "%02X" : "%02x", (unsigned int) hex_data[i]);
|
||||
|
||||
for (size_t j = 0; j < spaces_between; j++)
|
||||
|
|
Loading…
Add table
Reference in a new issue