]> cvs.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/mifarecmd.c
FIX: Coverity, unchecked return value, CID #121292,..
[proxmark3-svn] / armsrc / mifarecmd.c
index a77a2dd32c9666671a1e5519e7e32d5e98240ae8..91aa7218544ee6a2d8a23e72b81e164865b967b2 100644 (file)
@@ -1043,7 +1043,7 @@ void MifareEMemClr(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain)
 \r
 void MifareEMemSet(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain){\r
        FpgaDownloadAndGo(FPGA_BITSTREAM_HF);\r
-       //emlSetMem(datain, arg0, arg1); // data, block num, blocks count        \r
+       if (arg2==0) arg2 = 16; // backwards compat... default bytewidth\r
        emlSetMem_xt(datain, arg0, arg1, arg2); // data, block num, blocks count, block byte width\r
 }\r
 \r
@@ -1187,8 +1187,8 @@ void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain){
                if(!iso14443a_select_card(uid, NULL, &cuid, true, 0)) {\r
                        if (MF_DBGLEVEL >= MF_DBG_ERROR)        Dbprintf("Can't select card");\r
                        OnErrorMagic(MAGIC_UID);\r
-               };\r
-       };\r
+               }\r
+       }\r
        \r
        // wipe tag, fill it with zeros\r
        if (workFlags & MAGIC_WIPE){\r
@@ -1196,14 +1196,14 @@ void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain){
                if(!ReaderReceive(receivedAnswer, receivedAnswerPar) || (receivedAnswer[0] != 0x0a)) {\r
                        if (MF_DBGLEVEL >= MF_DBG_ERROR)        Dbprintf("wupC1 error");\r
                        OnErrorMagic(MAGIC_WIPE);\r
-               };\r
+               }\r
 \r
                ReaderTransmit(wipeC, sizeof(wipeC), NULL);\r
                if(!ReaderReceive(receivedAnswer, receivedAnswerPar) || (receivedAnswer[0] != 0x0a)) {\r
                        if (MF_DBGLEVEL >= MF_DBG_ERROR)        Dbprintf("wipeC error");\r
                        OnErrorMagic(MAGIC_WIPE);\r
-               };\r
-       };      \r
+               }\r
+       }       \r
 \r
        // write block\r
        if (workFlags & MAGIC_WUPC) {\r
@@ -1211,19 +1211,19 @@ void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain){
                if(!ReaderReceive(receivedAnswer, receivedAnswerPar) || (receivedAnswer[0] != 0x0a)) {\r
                        if (MF_DBGLEVEL >= MF_DBG_ERROR)        Dbprintf("wupC1 error");\r
                        OnErrorMagic(MAGIC_WUPC);\r
-               };\r
+               }\r
 \r
                ReaderTransmit(wupC2, sizeof(wupC2), NULL);\r
                if(!ReaderReceive(receivedAnswer, receivedAnswerPar) || (receivedAnswer[0] != 0x0a)) {\r
                        if (MF_DBGLEVEL >= MF_DBG_ERROR)        Dbprintf("wupC2 error");\r
                        OnErrorMagic(MAGIC_WUPC);\r
-               };\r
+               }\r
        }\r
 \r
        if ((mifare_sendcmd_short(NULL, 0, ISO14443A_CMD_WRITEBLOCK, blockNo, receivedAnswer, receivedAnswerPar, NULL) != 1) || (receivedAnswer[0] != 0x0a)) {\r
                if (MF_DBGLEVEL >= MF_DBG_ERROR)        Dbprintf("write block send command error");\r
                OnErrorMagic(4);\r
-       };\r
+       }\r
        \r
        memcpy(data, datain, 16);\r
        AppendCrc14443a(data, 16);\r
@@ -1232,7 +1232,7 @@ void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain){
        if ((ReaderReceive(receivedAnswer, receivedAnswerPar) != 1) || (receivedAnswer[0] != 0x0a)) {\r
                if (MF_DBGLEVEL >= MF_DBG_ERROR)        Dbprintf("write block send data error");\r
                OnErrorMagic(0);\r
-       };      \r
+       }       \r
        \r
        if (workFlags & MAGIC_OFF) \r
                mifare_classic_halt_ex(NULL);\r
@@ -1271,20 +1271,20 @@ void MifareCGetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain){
                if(!ReaderReceive(receivedAnswer, receivedAnswerPar) || (receivedAnswer[0] != 0x0a)) {\r
                        if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("wupC1 error");\r
                        OnErrorMagic(MAGIC_WUPC);\r
-               };\r
+               }\r
 \r
                ReaderTransmit(wupC2, sizeof(wupC2), NULL);\r
                if(!ReaderReceive(receivedAnswer, receivedAnswerPar) || (receivedAnswer[0] != 0x0a)) {\r
                        if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("wupC2 error");\r
                        OnErrorMagic(MAGIC_WUPC);\r
-               };\r
+               }\r
        }\r
 \r
        // read block           \r
        if ((mifare_sendcmd_short(NULL, 0, ISO14443A_CMD_READBLOCK, blockNo, receivedAnswer, receivedAnswerPar, NULL) != 18)) {\r
                if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("read block send command error");\r
                OnErrorMagic(0);\r
-       };\r
+       }\r
        \r
        memcpy(data, receivedAnswer, sizeof(data));\r
        \r
@@ -1309,19 +1309,19 @@ void MifareCGetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain){
 void MifareCIdent(){\r
        \r
        // variables\r
-       byte_t isOK = 1;        \r
+       bool isOK = true;       \r
        uint8_t receivedAnswer[1];\r
        uint8_t receivedAnswerPar[1];\r
 \r
        ReaderTransmitBitsPar(wupC1,7,0, NULL);\r
        if(!ReaderReceive(receivedAnswer, receivedAnswerPar) || (receivedAnswer[0] != 0x0a)) {\r
-               isOK = 0;\r
-       };\r
+               isOK = false;\r
+       }\r
 \r
        ReaderTransmit(wupC2, sizeof(wupC2), NULL);\r
        if(!ReaderReceive(receivedAnswer, receivedAnswerPar) || (receivedAnswer[0] != 0x0a)) {\r
-               isOK = 0;\r
-       };\r
+               isOK = false;\r
+       }\r
 \r
        // removed the if,  since some magic tags misbehavies and send an answer to it.\r
        mifare_classic_halt(NULL, 0);\r
Impressum, Datenschutz