Avoid BUFSIZ usage since it will be a HUGE buffer under linux (8192 bytes).
This commit is contained in:
parent
f0acc73541
commit
0b720d30cd
3 changed files with 5 additions and 5 deletions
|
@ -80,7 +80,7 @@ typedef struct {
|
|||
*/
|
||||
typedef struct {
|
||||
/** Device name (e.g. "ACS ACR 38U-CCID 00 00") */
|
||||
char acDevice[BUFSIZ];
|
||||
char acDevice[DEVICE_NAME_LENGTH];
|
||||
/** Driver name (e.g. "PN532_UART")*/
|
||||
char* pcDriver;
|
||||
/** Port (e.g. "/dev/ttyUSB0") */
|
||||
|
|
|
@ -167,8 +167,8 @@ acr122_list_devices(nfc_device_desc_t pnddDevices[], size_t szDevices, size_t *p
|
|||
if (bSupported)
|
||||
{
|
||||
// Supported ACR122 device found
|
||||
strncpy(pnddDevices[*pszDeviceFound].acDevice, acDeviceNames + szPos, BUFSIZ - 1);
|
||||
pnddDevices[*pszDeviceFound].acDevice[BUFSIZ - 1] = '\0';
|
||||
strncpy(pnddDevices[*pszDeviceFound].acDevice, acDeviceNames + szPos, DEVICE_NAME_LENGTH - 1);
|
||||
pnddDevices[*pszDeviceFound].acDevice[DEVICE_NAME_LENGTH - 1] = '\0';
|
||||
pnddDevices[*pszDeviceFound].pcDriver = ACR122_DRIVER_NAME;
|
||||
pnddDevices[*pszDeviceFound].uiBusIndex = uiBusIndex;
|
||||
(*pszDeviceFound)++;
|
||||
|
|
|
@ -106,8 +106,8 @@ pn532_uart_list_devices(nfc_device_desc_t pnddDevices[], size_t szDevices, size_
|
|||
{
|
||||
// PN532_UART device found
|
||||
uart_close(sp);
|
||||
snprintf(pnddDevices[*pszDeviceFound].acDevice, BUFSIZ - 1, "%s (%s)", "PN532", acConnect);
|
||||
pnddDevices[*pszDeviceFound].acDevice[BUFSIZ - 1] = '\0';
|
||||
snprintf(pnddDevices[*pszDeviceFound].acDevice, DEVICE_NAME_LENGTH - 1, "%s (%s)", "PN532", acConnect);
|
||||
pnddDevices[*pszDeviceFound].acDevice[DEVICE_NAME_LENGTH - 1] = '\0';
|
||||
pnddDevices[*pszDeviceFound].pcDriver = PN532_UART_DRIVER_NAME;
|
||||
//pnddDevices[*pszDeviceFound].pcPort = strndup(acConnect, BUFFER_LENGTH - 1);
|
||||
pnddDevices[*pszDeviceFound].pcPort = strdup(acConnect);
|
||||
|
|
Loading…
Add table
Reference in a new issue