]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdlft55xx.c
Merge branch 'master' into topaz
[proxmark3-svn] / client / cmdlft55xx.c
index 4d1eaa00d19b635d2827b58357116ac9ff18b315..b6b29c053240496b512951d4188f37c23997da29 100644 (file)
@@ -926,94 +926,96 @@ char * GetBitRateStr(uint32_t id){
        char *retStr = buf;\r
                switch (id){\r
                case 0: \r
-                       sprintf(retStr,"%d - RF/8",id);\r
+                       snprintf(retStr,sizeof(buf),"%d - RF/8",id);\r
                        break;\r
                case 1:\r
-                       sprintf(retStr,"%d - RF/16",id);\r
+                       snprintf(retStr,sizeof(buf),"%d - RF/16",id);\r
                        break;\r
                case 2:         \r
-                       sprintf(retStr,"%d - RF/32",id);\r
+                       snprintf(retStr,sizeof(buf),"%d - RF/32",id);\r
                        break;\r
                case 3:\r
-                       sprintf(retStr,"%d - RF/40",id);\r
+                       snprintf(retStr,sizeof(buf),"%d - RF/40",id);\r
                        break;\r
                case 4:\r
-                       sprintf(retStr,"%d - RF/50",id);\r
+                       snprintf(retStr,sizeof(buf),"%d - RF/50",id);\r
                        break;\r
                case 5:\r
-                       sprintf(retStr,"%d - RF/64",id);\r
+                       snprintf(retStr,sizeof(buf),"%d - RF/64",id);\r
                        break;\r
                case 6:\r
-                       sprintf(retStr,"%d - RF/100",id);\r
+                       snprintf(retStr,sizeof(buf),"%d - RF/100",id);\r
                        break;\r
                case 7:\r
-                       sprintf(retStr,"%d - RF/128",id);\r
+                       snprintf(retStr,sizeof(buf),"%d - RF/128",id);\r
                        break;\r
                default:\r
-                       sprintf(retStr,"%d - (Unknown)",id);\r
+                       snprintf(retStr,sizeof(buf),"%d - (Unknown)",id);\r
                        break;\r
                }\r
 \r
        return buf;\r
 }\r
 \r
+\r
 char * GetSaferStr(uint32_t id){\r
        static char buf[40];\r
        char *retStr = buf;\r
        \r
-       sprintf(retStr,"%d",id);\r
+       snprintf(retStr,sizeof(buf),"%d",id);\r
        if (id == 6) {\r
-               sprintf(retStr,"%d - passwd",id);\r
+               snprintf(retStr,sizeof(buf),"%d - passwd",id);\r
        }\r
        if (id == 9 ){\r
-               sprintf(retStr,"%d - testmode",id);\r
+               snprintf(retStr,sizeof(buf),"%d - testmode",id);\r
        }\r
        \r
        return buf;\r
 }\r
+\r
 char * GetModulationStr( uint32_t id){\r
        static char buf[40];\r
        char *retStr = buf;\r
        \r
        switch (id){\r
                case 0: \r
-                       sprintf(retStr,"%d - DIRECT (ASK/NRZ)",id);\r
+                       snprintf(retStr,sizeof(buf),"%d - DIRECT (ASK/NRZ)",id);\r
                        break;\r
                case 1:\r
-                       sprintf(retStr,"%d - PSK 1 phase change when input changes",id);\r
+                       snprintf(retStr,sizeof(buf),"%d - PSK 1 phase change when input changes",id);\r
                        break;\r
                case 2:         \r
-                       sprintf(retStr,"%d - PSK 2 phase change on bitclk if input high",id);\r
+                       snprintf(retStr,sizeof(buf),"%d - PSK 2 phase change on bitclk if input high",id);\r
                        break;\r
                case 3:\r
-                       sprintf(retStr,"%d - PSK 3 phase change on rising edge of input",id);\r
+                       snprintf(retStr,sizeof(buf),"%d - PSK 3 phase change on rising edge of input",id);\r
                        break;\r
                case 4:\r
-                       sprintf(retStr,"%d - FSK 1 RF/8  RF/5",id);\r
+                       snprintf(retStr,sizeof(buf),"%d - FSK 1 RF/8  RF/5",id);\r
                        break;\r
                case 5:\r
-                       sprintf(retStr,"%d - FSK 2 RF/8  RF/10",id);\r
+                       snprintf(retStr,sizeof(buf),"%d - FSK 2 RF/8  RF/10",id);\r
                        break;\r
                case 6:\r
-                       sprintf(retStr,"%d - FSK 1a RF/5  RF/8",id);\r
+                       snprintf(retStr,sizeof(buf),"%d - FSK 1a RF/5  RF/8",id);\r
                        break;\r
                case 7:\r
-                       sprintf(retStr,"%d - FSK 2a RF/10  RF/8",id);\r
+                       snprintf(retStr,sizeof(buf),"%d - FSK 2a RF/10  RF/8",id);\r
                        break;\r
                case 8:\r
-                       sprintf(retStr,"%d - Manschester",id);\r
+                       snprintf(retStr,sizeof(buf),"%d - Manschester",id);\r
                        break;\r
                case 16:\r
-                       sprintf(retStr,"%d - Biphase",id);\r
+                       snprintf(retStr,sizeof(buf),"%d - Biphase",id);\r
                        break;\r
                case 0x18:\r
-                       sprintf(retStr,"%d - Biphase a - AKA Conditional Dephase Encoding(CDP)",id);\r
+                       snprintf(retStr,sizeof(buf),"%d - Biphase a - AKA Conditional Dephase Encoding(CDP)",id);\r
                        break;\r
                case 17:\r
-                       sprintf(retStr,"%d - Reserved",id);\r
+                       snprintf(retStr,sizeof(buf),"%d - Reserved",id);\r
                        break;\r
                default:\r
-                       sprintf(retStr,"0x%02X (Unknown)",id);\r
+                       snprintf(retStr,sizeof(buf),"0x%02X (Unknown)",id);\r
                        break;\r
                }\r
        return buf;\r
@@ -1031,48 +1033,48 @@ char * GetModelStrFromCID(uint32_t cid){
 \r
 char * GetSelectedModulationStr( uint8_t id){\r
 \r
-       static char buf[16];\r
+       static char buf[20];\r
        char *retStr = buf;\r
 \r
        switch (id){\r
                case DEMOD_FSK:\r
-                       sprintf(retStr,"FSK");\r
+                       snprintf(retStr,sizeof(buf),"FSK");\r
                        break;\r
                case DEMOD_FSK1:\r
-                       sprintf(retStr,"FSK1");\r
+                       snprintf(retStr,sizeof(buf),"FSK1");\r
                        break;\r
                case DEMOD_FSK1a:\r
-                       sprintf(retStr,"FSK1a");\r
+                       snprintf(retStr,sizeof(buf),"FSK1a");\r
                        break;\r
                case DEMOD_FSK2:\r
-                       sprintf(retStr,"FSK2");\r
+                       snprintf(retStr,sizeof(buf),"FSK2");\r
                        break;\r
                case DEMOD_FSK2a:\r
-                       sprintf(retStr,"FSK2a");\r
+                       snprintf(retStr,sizeof(buf),"FSK2a");\r
                        break;\r
                case DEMOD_ASK:         \r
-                       sprintf(retStr,"ASK");\r
+                       snprintf(retStr,sizeof(buf),"ASK");\r
                        break;\r
                case DEMOD_NRZ:\r
-                       sprintf(retStr,"DIRECT/NRZ");\r
+                       snprintf(retStr,sizeof(buf),"DIRECT/NRZ");\r
                        break;\r
                case DEMOD_PSK1:\r
-                       sprintf(retStr,"PSK1");\r
+                       snprintf(retStr,sizeof(buf),"PSK1");\r
                        break;\r
                case DEMOD_PSK2:\r
-                       sprintf(retStr,"PSK2");\r
+                       snprintf(retStr,sizeof(buf),"PSK2");\r
                        break;\r
                case DEMOD_PSK3:\r
-                       sprintf(retStr,"PSK3");\r
+                       snprintf(retStr,sizeof(buf),"PSK3");\r
                        break;\r
                case DEMOD_BI:\r
-                       sprintf(retStr,"BIPHASE");\r
+                       snprintf(retStr,sizeof(buf),"BIPHASE");\r
                        break;\r
                case DEMOD_BIa:\r
-                       sprintf(retStr,"BIPHASEa - (CDP)");\r
+                       snprintf(retStr,sizeof(buf),"BIPHASEa - (CDP)");\r
                        break;\r
                default:\r
-                       sprintf(retStr,"(Unknown)");\r
+                       snprintf(retStr,sizeof(buf),"(Unknown)");\r
                        break;\r
                }\r
        return buf;\r
Impressum, Datenschutz