BUG: missing %s in printing version tagtype. Thanks @Marshmellow!

BUG: buffer overflow when reading the Capability Container.   Thanks @Marshmellow!
This commit is contained in:
iceman1001 2015-05-05 13:25:54 +02:00
commit 996fda30ee

View file

@ -65,7 +65,7 @@ char* getProductTypeStr( uint8_t id){
sprintf(retStr, "0x%02X %s", id, "(NTAG)"); sprintf(retStr, "0x%02X %s", id, "(NTAG)");
break; break;
default: default:
sprintf(retStr, "0x%02X ", id, "(unknown)"); sprintf(retStr, "0x%02X %s", id, "(unknown)");
break; break;
} }
return buf; return buf;
@ -148,6 +148,7 @@ static int ul_select( iso14a_card_select_t *card ){
return resp.arg[0]; return resp.arg[0];
} }
// This read command will at least return 16bytes.
static int ul_read( uint8_t page, uint8_t *response ){ static int ul_read( uint8_t page, uint8_t *response ){
uint8_t cmd[] = {ISO14443A_CMD_READBLOCK, page}; uint8_t cmd[] = {ISO14443A_CMD_READBLOCK, page};
@ -489,7 +490,7 @@ int CmdHF14AMfUInfo(const char *Cmd){
if ((tagtype & (NTAG_213 | NTAG_215 | NTAG_216))){ if ((tagtype & (NTAG_213 | NTAG_215 | NTAG_216))){
PrintAndLog("--- Trying some NTAG stuff"); PrintAndLog("--- Trying some NTAG stuff");
uint8_t cc[4] = {0x00}; uint8_t cc[16] = {0x00};
status = ul_read(2, cc); status = ul_read(2, cc);
if ( status == -1 ){ if ( status == -1 ){
PrintAndLog("Error: tag didn't answer to READ"); PrintAndLog("Error: tag didn't answer to READ");