]> cvs.zerfleddert.de Git - proxmark3-svn/commitdiff
Fix incorrect memset parameters in lf t55xx wipe 149/head
authormarshmellow42 <marshmellowrf@gmail.com>
Thu, 10 Dec 2015 03:44:01 +0000 (22:44 -0500)
committermarshmellow42 <marshmellowrf@gmail.com>
Thu, 10 Dec 2015 03:44:01 +0000 (22:44 -0500)
thanks @iceman1001 for the catch

add added a restore graphbuffer after lf t55xx psk demodulation

client/cmdlft55xx.c

index fc587298cfd3588d8dd46595ac48a5615b6f30b7..868126c900fd65a84d7c7a269744e0c1097cee12 100644 (file)
@@ -385,17 +385,23 @@ bool DecodeT55xxBlock(){
                        break;\r
                case DEMOD_PSK1:\r
                        // skip first 160 samples to allow antenna to settle in (psk gets inverted occasionally otherwise)\r
                        break;\r
                case DEMOD_PSK1:\r
                        // skip first 160 samples to allow antenna to settle in (psk gets inverted occasionally otherwise)\r
+                       save_restoreGB(1);\r
                        CmdLtrim("160");\r
                        snprintf(cmdStr, sizeof(buf),"%d %d 6", bitRate[config.bitrate], config.inverted );\r
                        ans = PSKDemod(cmdStr, FALSE);\r
                        CmdLtrim("160");\r
                        snprintf(cmdStr, sizeof(buf),"%d %d 6", bitRate[config.bitrate], config.inverted );\r
                        ans = PSKDemod(cmdStr, FALSE);\r
+                       //undo trim samples\r
+                       save_restoreGB(0);\r
                        break;\r
                case DEMOD_PSK2: //inverted won't affect this\r
                case DEMOD_PSK3: //not fully implemented\r
                        // skip first 160 samples to allow antenna to settle in (psk gets inverted occasionally otherwise)\r
                        break;\r
                case DEMOD_PSK2: //inverted won't affect this\r
                case DEMOD_PSK3: //not fully implemented\r
                        // skip first 160 samples to allow antenna to settle in (psk gets inverted occasionally otherwise)\r
+                       save_restoreGB(1);\r
                        CmdLtrim("160");\r
                        snprintf(cmdStr, sizeof(buf),"%d 0 6", bitRate[config.bitrate] );\r
                        ans = PSKDemod(cmdStr, FALSE);\r
                        psk1TOpsk2(DemodBuffer, DemodBufferLen);\r
                        CmdLtrim("160");\r
                        snprintf(cmdStr, sizeof(buf),"%d 0 6", bitRate[config.bitrate] );\r
                        ans = PSKDemod(cmdStr, FALSE);\r
                        psk1TOpsk2(DemodBuffer, DemodBufferLen);\r
+                       //undo trim samples\r
+                       save_restoreGB(0);\r
                        break;\r
                case DEMOD_NRZ:\r
                        snprintf(cmdStr, sizeof(buf),"%d %d 1", bitRate[config.bitrate], config.inverted );\r
                        break;\r
                case DEMOD_NRZ:\r
                        snprintf(cmdStr, sizeof(buf),"%d %d 1", bitRate[config.bitrate], config.inverted );\r
@@ -1310,7 +1316,7 @@ int CmdT55xxWipe(const char *Cmd) {
                if (!CmdT55xxWriteBlock(ptrData))\r
                        PrintAndLog("Error writing blk %d", blk);\r
 \r
                if (!CmdT55xxWriteBlock(ptrData))\r
                        PrintAndLog("Error writing blk %d", blk);\r
 \r
-               memset(writeData, sizeof(writeData), 0x00);\r
+               memset(writeData, 0x00, sizeof(writeData));\r
        }\r
        return 0;\r
 }\r
        }\r
        return 0;\r
 }\r
Impressum, Datenschutz