]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
FIX: CoverityScan complains on getchar(), not reading the returning value
authoriceman1001 <iceman@iuse.se>
Tue, 19 Jan 2016 15:58:07 +0000 (16:58 +0100)
committericeman1001 <iceman@iuse.se>
Tue, 19 Jan 2016 15:58:07 +0000 (16:58 +0100)
client/cmdhfmf.c
client/cmdlft55xx.c

index 177d263266dbbdcbe98a69190d1a737159066d90..00252661d04360cd1e29ddd93ac825deee377a03 100644 (file)
@@ -20,7 +20,8 @@ int CmdHF14AMifare(const char *Cmd)
        uint32_t nt = 0, nr = 0;\r
        uint64_t par_list = 0, ks_list = 0, r_key = 0;\r
        int16_t isOK = 0;\r
-\r
+       int tmpchar; \r
+       \r
        UsbCommand c = {CMD_READER_MIFARE, {true, 0, 0}};\r
 \r
        // message\r
@@ -29,21 +30,25 @@ int CmdHF14AMifare(const char *Cmd)
        printf("Press button on the proxmark3 device to abort both proxmark3 and client.\n");\r
        printf("-------------------------------------------------------------------------\n");\r
 \r
-       time_t time1 = clock();\r
+       clock_t t = clock();\r
        \r
 start:\r
     clearCommandBuffer();\r
     SendCommand(&c);\r
        \r
        //flush queue\r
-       while (ukbhit()) getchar();\r
+       while (ukbhit()) {\r
+               tmpchar = getchar();\r
+               (void)tmpchar;\r
+       }\r
 \r
        // wait cycle\r
        while (true) {\r
         printf(".");\r
                fflush(stdout);\r
                if (ukbhit()) {\r
-                       getchar();\r
+                       tmpchar = getchar();\r
+                       (void)tmpchar;\r
                        printf("\naborted via keyboard!\n");\r
                        break;\r
                }\r
@@ -86,9 +91,9 @@ start:
                printf("------------------------------------------------------------------\n");\r
                PrintAndLog("Found valid key: %012"llx" \n", r_key);\r
        }\r
-       \r
-       PrintAndLog("Time in darkside: %1.0f seconds", (float)(clock() - time1)/CLOCKS_PER_SEC);\r
-       PrintAndLog("");\r
+       t = clock() - t;\r
+       //printf("Time in darkside: %d ticks - %1.2f seconds\n", t, ((float)t)/CLOCKS_PER_SEC);\r
+       printf("Time in darkside: %Lf ticks - %1.2Lf seconds\n", (long double)t, ((long double)t)/CLOCKS_PER_SEC);\r
        return 0;\r
 }\r
 \r
@@ -765,7 +770,7 @@ int CmdHF14AMfNested(const char *Cmd)
                        }\r
                }\r
                \r
-               PrintAndLog("Time in nested: %1.3f (%1.3f sec per key)\n\n", ((float)clock() - time1)/CLOCKS_PER_SEC, ((float)clock() - time1)/iterations/CLOCKS_PER_SEC);\r
+               PrintAndLog("Time in nested: %1.2f (%1.2f sec per key)\n\n", ((float)clock() - time1)/CLOCKS_PER_SEC, ((float)clock() - time1)/iterations/CLOCKS_PER_SEC);\r
                \r
                PrintAndLog("-----------------------------------------------\nIterations count: %d\n\n", iterations);\r
                //print them\r
@@ -1120,7 +1125,7 @@ int CmdHF14AMfChk(const char *Cmd)
                }\r
        }\r
        // time\r
-       time_t time1 = clock();\r
+       clock_t time1 = clock();\r
                \r
        for ( int t = !keyType; t < 2; keyType==2?(t++):(t=2) ) {\r
                int b=blockNo;\r
@@ -2012,6 +2017,7 @@ int CmdHF14AMfSniff(const char *Cmd){
        bool wantSaveToEmlFile = 0;\r
 \r
        //var \r
+       int tmpchar;\r
        int res = 0;\r
        int len = 0;\r
        int blockLen = 0;\r
@@ -2062,7 +2068,8 @@ int CmdHF14AMfSniff(const char *Cmd){
                printf(".");\r
                fflush(stdout);\r
                if (ukbhit()) {\r
-                       getchar();\r
+                       tmpchar = getchar();\r
+                       (void)tmpchar;\r
                        printf("\naborted via keyboard!\n");\r
                        break;\r
                }\r
index b26973e613c79034566d8db77ca4d4fbdf04c32c..7684bcc721fdb5adda1606d937bbb90d772c20b3 100644 (file)
@@ -1377,6 +1377,7 @@ int CmdT55xxBruteForce(const char *Cmd) {
        char buf[9];\r
        char filename[FILE_PATH_SIZE]={0};\r
        int     keycnt = 0;\r
+       int c;\r
        uint8_t stKeyBlock = 20;\r
        uint8_t *keyBlock = NULL, *p = NULL;\r
        keyBlock = calloc(stKeyBlock, 6);\r
@@ -1451,7 +1452,8 @@ int CmdT55xxBruteForce(const char *Cmd) {
                for (uint16_t c = 0; c < keycnt; ++c ) {\r
        \r
                        if (ukbhit()) {\r
-                               getchar();\r
+                               c = getchar();\r
+                               (void)c;\r
                                printf("\naborted via keyboard!\n");\r
                                free(keyBlock);\r
                                return 0;\r
@@ -1501,7 +1503,8 @@ int CmdT55xxBruteForce(const char *Cmd) {
                printf(".");\r
                fflush(stdout);\r
                if (ukbhit()) {\r
-                       getchar();\r
+                       c = getchar();\r
+                       (void)c;\r
                        printf("\naborted via keyboard!\n");\r
                        free(keyBlock);\r
                        return 0;\r
Impressum, Datenschutz