Minor bug fixes with help from Holiman.
FIX: sprint_hex, sprint_bin has better length detection. FIX: ui.c has removed all c99 array declarations, with malloc FIX: hfmfmfu.c wrong length in one array caused crashes in CmdHF14AMfURdCard FIX: cmdlft55xx.c CmdDump has now a correct pwd string.
This commit is contained in:
@@ -103,22 +103,26 @@ void print_hex(const uint8_t * data, const size_t len)
|
||||
}
|
||||
|
||||
char * sprint_hex(const uint8_t * data, const size_t len) {
|
||||
|
||||
int maxLen = ( len > 1024/3) ? 1024/3 : len;
|
||||
static char buf[1024];
|
||||
char * tmp = buf;
|
||||
size_t i;
|
||||
|
||||
for (i=0; i < len && i < 1024/3; i++, tmp += 3)
|
||||
for (i=0; i < maxLen; ++i, tmp += 3)
|
||||
sprintf(tmp, "%02x ", data[i]);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
char * sprint_bin(const uint8_t * data, const size_t len) {
|
||||
|
||||
int maxLen = ( len > 1024) ? 1024 : len;
|
||||
static char buf[1024];
|
||||
char * tmp = buf;
|
||||
size_t i;
|
||||
|
||||
for (i=0; i < len && i < 1024; i++, tmp++)
|
||||
for (i=0; i < maxLen; ++i, ++tmp)
|
||||
sprintf(tmp, "%u", data[i]);
|
||||
|
||||
return buf;
|
||||
|
||||
Reference in New Issue
Block a user