From 534678c3e938f01245585afd20f936be18baf2f2 Mon Sep 17 00:00:00 2001 From: marshmellow42 Date: Wed, 9 Dec 2015 22:44:01 -0500 Subject: [PATCH] Fix incorrect memset parameters in lf t55xx wipe thanks @iceman1001 for the catch add added a restore graphbuffer after lf t55xx psk demodulation --- client/cmdlft55xx.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/client/cmdlft55xx.c b/client/cmdlft55xx.c index fc587298..868126c9 100644 --- a/client/cmdlft55xx.c +++ b/client/cmdlft55xx.c @@ -385,17 +385,23 @@ bool DecodeT55xxBlock(){ break; case DEMOD_PSK1: // skip first 160 samples to allow antenna to settle in (psk gets inverted occasionally otherwise) + save_restoreGB(1); CmdLtrim("160"); snprintf(cmdStr, sizeof(buf),"%d %d 6", bitRate[config.bitrate], config.inverted ); ans = PSKDemod(cmdStr, FALSE); + //undo trim samples + save_restoreGB(0); break; case DEMOD_PSK2: //inverted won't affect this case DEMOD_PSK3: //not fully implemented // skip first 160 samples to allow antenna to settle in (psk gets inverted occasionally otherwise) + save_restoreGB(1); CmdLtrim("160"); snprintf(cmdStr, sizeof(buf),"%d 0 6", bitRate[config.bitrate] ); ans = PSKDemod(cmdStr, FALSE); psk1TOpsk2(DemodBuffer, DemodBufferLen); + //undo trim samples + save_restoreGB(0); break; case DEMOD_NRZ: snprintf(cmdStr, sizeof(buf),"%d %d 1", bitRate[config.bitrate], config.inverted ); @@ -1310,7 +1316,7 @@ int CmdT55xxWipe(const char *Cmd) { if (!CmdT55xxWriteBlock(ptrData)) PrintAndLog("Error writing blk %d", blk); - memset(writeData, sizeof(writeData), 0x00); + memset(writeData, 0x00, sizeof(writeData)); } return 0; } -- 2.39.5