mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
Coverity-fixes in armsrc
This commit is contained in:
parent
97d582a692
commit
2ed270a854
6 changed files with 104 additions and 91 deletions
|
@ -419,7 +419,7 @@ int EPA_Setup()
|
||||||
// return code
|
// return code
|
||||||
int return_code = 0;
|
int return_code = 0;
|
||||||
// card UID
|
// card UID
|
||||||
uint8_t uid[8];
|
uint8_t uid[10];
|
||||||
// card select information
|
// card select information
|
||||||
iso14a_card_select_t card_select_info;
|
iso14a_card_select_t card_select_info;
|
||||||
// power up the field
|
// power up the field
|
||||||
|
|
|
@ -1158,7 +1158,7 @@ void ReaderHitag(hitag_function htf, hitag_data* htd) {
|
||||||
|
|
||||||
case RHT2F_CRYPTO: {
|
case RHT2F_CRYPTO: {
|
||||||
DbpString("Authenticating using key:");
|
DbpString("Authenticating using key:");
|
||||||
memcpy(key,htd->crypto.key,6);
|
memcpy(key,htd->crypto.key,4);
|
||||||
Dbhexdump(6,key,false);
|
Dbhexdump(6,key,false);
|
||||||
blocknr = 0;
|
blocknr = 0;
|
||||||
bQuiet = false;
|
bQuiet = false;
|
||||||
|
|
|
@ -1295,8 +1295,8 @@ static void TransmitIClassCommand(const uint8_t *cmd, int len, int *samples, int
|
||||||
FpgaSetupSsc();
|
FpgaSetupSsc();
|
||||||
|
|
||||||
if (wait)
|
if (wait)
|
||||||
if(*wait < 10)
|
{
|
||||||
*wait = 10;
|
if(*wait < 10) *wait = 10;
|
||||||
|
|
||||||
for(c = 0; c < *wait;) {
|
for(c = 0; c < *wait;) {
|
||||||
if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_TXRDY)) {
|
if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_TXRDY)) {
|
||||||
|
@ -1310,6 +1310,9 @@ static void TransmitIClassCommand(const uint8_t *cmd, int len, int *samples, int
|
||||||
WDT_HIT();
|
WDT_HIT();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
uint8_t sendbyte;
|
uint8_t sendbyte;
|
||||||
bool firstpart = TRUE;
|
bool firstpart = TRUE;
|
||||||
c = 0;
|
c = 0;
|
||||||
|
|
|
@ -1726,7 +1726,13 @@ int iso14443a_select_card(byte_t* uid_ptr, iso14a_card_select_t* p_hi14a_card, u
|
||||||
if ((sak & 0x04) /* && uid_resp[0] == 0x88 */) {
|
if ((sak & 0x04) /* && uid_resp[0] == 0x88 */) {
|
||||||
// Remove first byte, 0x88 is not an UID byte, it CT, see page 3 of:
|
// Remove first byte, 0x88 is not an UID byte, it CT, see page 3 of:
|
||||||
// http://www.nxp.com/documents/application_note/AN10927.pdf
|
// http://www.nxp.com/documents/application_note/AN10927.pdf
|
||||||
memcpy(uid_resp, uid_resp + 1, 3);
|
// This was earlier:
|
||||||
|
//memcpy(uid_resp, uid_resp + 1, 3);
|
||||||
|
// But memcpy should not be used for overlapping arrays,
|
||||||
|
// and memmove appears to not be available in the arm build.
|
||||||
|
// So this has been replaced with a for-loop:
|
||||||
|
for(int xx = 0; xx < 3; xx++) uid_resp[xx] = uid_resp[xx+1];
|
||||||
|
|
||||||
uid_resp_len = 3;
|
uid_resp_len = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1936,7 +1942,8 @@ void ReaderMifare(bool first_try)
|
||||||
uint8_t uid[10];
|
uint8_t uid[10];
|
||||||
uint32_t cuid;
|
uint32_t cuid;
|
||||||
|
|
||||||
uint32_t nt, previous_nt;
|
uint32_t nt =0 ;
|
||||||
|
uint32_t previous_nt = 0;
|
||||||
static uint32_t nt_attacked = 0;
|
static uint32_t nt_attacked = 0;
|
||||||
byte_t par_list[8] = {0,0,0,0,0,0,0,0};
|
byte_t par_list[8] = {0,0,0,0,0,0,0,0};
|
||||||
byte_t ks_list[8] = {0,0,0,0,0,0,0,0};
|
byte_t ks_list[8] = {0,0,0,0,0,0,0,0};
|
||||||
|
|
|
@ -1521,9 +1521,12 @@ int DemodPCF7931(uint8_t **outBlocks) {
|
||||||
block_done = 0;
|
block_done = 0;
|
||||||
half_switch = 0;
|
half_switch = 0;
|
||||||
}
|
}
|
||||||
|
if(i < GraphTraceLen)
|
||||||
|
{
|
||||||
if (GraphBuffer[i-1] > GraphBuffer[i]) dir=0;
|
if (GraphBuffer[i-1] > GraphBuffer[i]) dir=0;
|
||||||
else dir = 1;
|
else dir = 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(bitidx==255)
|
if(bitidx==255)
|
||||||
bitidx=0;
|
bitidx=0;
|
||||||
warnings = 0;
|
warnings = 0;
|
||||||
|
|
|
@ -225,7 +225,7 @@ void FormatVersionInformation(char *dst, int len, const char *prefix, void *vers
|
||||||
{
|
{
|
||||||
struct version_information *v = (struct version_information*)version_information;
|
struct version_information *v = (struct version_information*)version_information;
|
||||||
dst[0] = 0;
|
dst[0] = 0;
|
||||||
strncat(dst, prefix, len);
|
strncat(dst, prefix, len-1);
|
||||||
if(v->magic != VERSION_INFORMATION_MAGIC) {
|
if(v->magic != VERSION_INFORMATION_MAGIC) {
|
||||||
strncat(dst, "Missing/Invalid version information", len - strlen(dst) - 1);
|
strncat(dst, "Missing/Invalid version information", len - strlen(dst) - 1);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue