mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-04-16 17:35:03 +08:00
CHG: clearing a char array before using.
This commit is contained in:
parent
aebe77905b
commit
334cc089c9
1 changed files with 5 additions and 3 deletions
|
@ -108,15 +108,16 @@ void print_hex(const uint8_t * data, const size_t len)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
char * sprint_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;
|
int maxLen = ( len > 1024/3) ? 1024/3 : len;
|
||||||
static char buf[1024];
|
static char buf[1024];
|
||||||
char * tmp = buf;
|
memset(buf, 0x00, 1024);
|
||||||
|
char *tmp = buf;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i=0; i < maxLen; ++i, tmp += 3)
|
for (i=0; i < maxLen; ++i, tmp += 3)
|
||||||
sprintf(tmp, "%02x ", data[i]);
|
sprintf(tmp, "%02X ", data[i]);
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
@ -125,6 +126,7 @@ char *sprint_bin_break(const uint8_t *data, const size_t len, const uint8_t brea
|
||||||
|
|
||||||
int maxLen = ( len > 1024) ? 1024 : len;
|
int maxLen = ( len > 1024) ? 1024 : len;
|
||||||
static char buf[1024];
|
static char buf[1024];
|
||||||
|
memset(buf, 0x00, 1024);
|
||||||
char *tmp = buf;
|
char *tmp = buf;
|
||||||
|
|
||||||
for (size_t i=0; i < maxLen; ++i){
|
for (size_t i=0; i < maxLen; ++i){
|
||||||
|
|
Loading…
Add table
Reference in a new issue