mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-14 02:26:59 -07:00
some coverity fixes plus fix fdx help (#328)
* coverity fixes cmdhflegic- indications are the i in calls to data_buf[i] could = 1052 and overflow the array. cmdhfmfhard - +1 to add space for string null terminator - should we add the 0 terminator value too? reveng.c - memory leak util.c - fix potential overflow of array buf[] util_posix.c - possible integer overflow * fix help errors * fix sprint_hex_ascii again and this function is not even used anywhere... yet...
This commit is contained in:
parent
58c00ce7fc
commit
bf8243475b
6 changed files with 11 additions and 9 deletions
|
@ -193,13 +193,14 @@ char *sprint_hex_ascii(const uint8_t *data, const size_t len) {
|
|||
static char buf[1024];
|
||||
char *tmp = buf;
|
||||
memset(buf, 0x00, 1024);
|
||||
size_t max_len = (len > 1010) ? 1010 : len;
|
||||
|
||||
size_t max_len = (len > 255) ? 255 : len;
|
||||
// max 255 bytes * 3 + 2 characters = 767 in buffer
|
||||
sprintf(tmp, "%s| ", sprint_hex(data, max_len) );
|
||||
|
||||
size_t i = 0;
|
||||
size_t pos = (max_len * 3)+2;
|
||||
while(i < max_len){
|
||||
// add another 255 characters ascii = 1020 characters of buffer used
|
||||
while(i < max_len) {
|
||||
char c = data[i];
|
||||
if ( (c < 32) || (c == 127))
|
||||
c = '.';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue