From: marshmellow42 <marshmellowrf@gmail.com>
Date: Thu, 10 Dec 2015 03:44:01 +0000 (-0500)
Subject: Fix incorrect memset parameters in lf t55xx wipe
X-Git-Tag: v2.3.0~13^2
X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/534678c3e938f01245585afd20f936be18baf2f2?ds=inline;hp=-c

Fix incorrect memset parameters in lf t55xx wipe

thanks @iceman1001 for the catch

add added a restore graphbuffer after lf t55xx psk demodulation
---

534678c3e938f01245585afd20f936be18baf2f2
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;
 }