Always set the size of Rx buffer (prevent from overflow)

This commit is contained in:
Romuald Conty 2011-03-02 15:02:30 +00:00
parent 5af845cdfc
commit 4b6ba0aa3c
10 changed files with 12 additions and 12 deletions

View file

@ -51,7 +51,7 @@ bool
nfc_initiator_mifare_cmd (nfc_device_t * pnd, const mifare_cmd mc, const uint8_t ui8Block, mifare_param * pmp)
{
byte_t abtRx[265];
size_t szRx;
size_t szRx = sizeof(abtRx);
size_t szParamLen;
byte_t abtCmd[265];
bool bEasyFraming;

View file

@ -54,7 +54,7 @@
static byte_t abtRx[MAX_FRAME_LEN];
static size_t szRxBits;
static size_t szRx;
static size_t szRx = sizeof(abtRx);
static byte_t abtRawUid[12];
static byte_t abtAtqa[2];
static byte_t abtSak;

View file

@ -53,7 +53,7 @@ main (int argc, const char *argv[])
nfc_device_t *pnd;
nfc_target_t nt;
byte_t abtRx[MAX_FRAME_LEN];
size_t szRx;
size_t szRx = sizeof(abtRx);
byte_t abtTx[] = "Hello World!";
if (argc > 1) {

View file

@ -50,7 +50,7 @@ int
main (int argc, const char *argv[])
{
byte_t abtRx[MAX_FRAME_LEN];
size_t szRx;
size_t szRx = sizeof(abtRx);
size_t szDeviceFound;
byte_t abtTx[] = "Hello Mars!";
nfc_device_t *pnd;

View file

@ -68,7 +68,7 @@
#define MAX_FRAME_LEN 264
static byte_t abtRx[MAX_FRAME_LEN];
static size_t szRx;
static size_t szRx = sizeof(abtRx);
static nfc_device_t *pnd;
static bool quiet_output = false;

View file

@ -56,7 +56,7 @@
#define SAK_ISO14443_4_COMPLIANT 0x20
static byte_t abtRx[MAX_FRAME_LEN];
static size_t szRx;
static size_t szRx = sizeof(abtRx);
static nfc_device_t *pnd;
static bool quiet_output = false;
static bool init_mfc_auth = false;

View file

@ -55,7 +55,7 @@ main (int argc, const char *argv[])
bool result;
byte_t abtRx[PN53x_EXTENDED_FRAME__DATA_MAX_LEN];
size_t szRx;
size_t szRx = sizeof(abtRx);
const byte_t pncmd_diagnose_communication_line_test[] = { 0xD4, 0x00, 0x00, 0x06, 'l', 'i', 'b', 'n', 'f', 'c' };
const byte_t pncmd_diagnose_rom_test[] = { 0xD4, 0x00, 0x01 };
const byte_t pncmd_diagnose_ram_test[] = { 0xD4, 0x00, 0x02 };

View file

@ -74,7 +74,7 @@ sam_connection (nfc_device_t * pnd, int mode)
size_t szCmd = 0;
byte_t abtRx[MAX_FRAME_LEN];
size_t szRx;
size_t szRx = sizeof(abtRx);
pncmd_sam_config[2] = mode;
@ -210,7 +210,7 @@ main (int argc, const char *argv[])
case DUAL_CARD_MODE:
{
byte_t abtRx[MAX_FRAME_LEN];
size_t szRx;
size_t szRx = sizeof(abtRx);
nfc_target_t nt = {
.nm = {

View file

@ -63,7 +63,7 @@ int main(int argc, const char* argv[])
nfc_device_t* pnd;
byte_t abtRx[MAX_FRAME_LEN];
byte_t abtTx[MAX_FRAME_LEN] = { 0xD4 };
size_t szRx;
size_t szRx = sizeof(abtRx);
size_t szTx;
extern FILE* stdin;
FILE* input = NULL;

View file

@ -371,7 +371,7 @@ void
arygon_ack (const nfc_device_spec_t nds)
{
byte_t abtRx[BUFFER_LENGTH];
size_t szRx;
size_t szRx = sizeof(abtRx);
#ifdef DEBUG
PRINT_HEX ("TX", arygon_ack_frame, sizeof (arygon_ack_frame));
#endif
@ -392,7 +392,7 @@ bool
arygon_check_communication (const nfc_device_spec_t nds)
{
byte_t abtRx[RX_BUFFER_LENGTH];
size_t szRx;
size_t szRx = sizeof(abtRx);
const byte_t attempted_result[] = { 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, // ACK
0x00, 0x00, 0xff, 0x09, 0xf7, 0xd5, 0x01, 0x00, 'l', 'i', 'b', 'n', 'f', 'c', 0xbc, 0x00 }; // Reply
int res;