mirror of
https://github.com/nfc-tools/libnfc.git
synced 2026-04-11 17:16:18 +00:00
Replace some sprintf with snprintf to prevent from buffer-overflow.
This commit is contained in:
@@ -195,9 +195,9 @@ nfc_device_t* nfc_connect(nfc_device_desc_t* pndd)
|
||||
// Add the firmware revision to the device name, PN531 gives 2 bytes info, but PN532 gives 4
|
||||
switch(pnd->nc)
|
||||
{
|
||||
case NC_PN531: sprintf(pnd->acName,"%s - PN531 v%d.%d",pnd->acName,abtFw[0],abtFw[1]); break;
|
||||
case NC_PN532: sprintf(pnd->acName,"%s - PN532 v%d.%d (0x%02x)",pnd->acName,abtFw[1],abtFw[2],abtFw[3]); break;
|
||||
case NC_PN533: sprintf(pnd->acName,"%s - PN533 v%d.%d (0x%02x)",pnd->acName,abtFw[1],abtFw[2],abtFw[3]); break;
|
||||
case NC_PN531: snprintf(pnd->acName,DEVICE_NAME_LENGTH - 1,"%s - PN531 v%d.%d",pnd->acName,abtFw[0],abtFw[1]); break;
|
||||
case NC_PN532: snprintf(pnd->acName,DEVICE_NAME_LENGTH - 1,"%s - PN532 v%d.%d (0x%02x)",pnd->acName,abtFw[1],abtFw[2],abtFw[3]); break;
|
||||
case NC_PN533: snprintf(pnd->acName,DEVICE_NAME_LENGTH - 1,"%s - PN533 v%d.%d (0x%02x)",pnd->acName,abtFw[1],abtFw[2],abtFw[3]); break;
|
||||
}
|
||||
|
||||
// Reset the ending transmission bits register, it is unknown what the last tranmission used there
|
||||
|
||||
Reference in New Issue
Block a user