From 33c7e2f3bc324a122fb9db8dca23efcd425a3cec Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Thu, 29 Jan 2015 22:22:29 +0100 Subject: [PATCH 1/2] wrong letter in variable name Conflicts: client/cmddata.c --- client/cmddata.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client/cmddata.c b/client/cmddata.c index 8c91f0e11..cf4dc6b9b 100644 --- a/client/cmddata.c +++ b/client/cmddata.c @@ -56,6 +56,11 @@ void printDemodBuff() return; } if (bitLen>512) bitLen=512; //max output to 512 bits if we have more - should be plenty + + // equally divided by 16 + if ( bitLen % 16 > 0) + bitLen = (bitLen/16); + for (i = 0; i <= (bitLen-16); i+=16) { PrintAndLog("%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i", DemodBuffer[i], From 0c5998c0518144270e9c85c2771bf29ddd906384 Mon Sep 17 00:00:00 2001 From: Iceman Date: Fri, 30 Jan 2015 15:17:07 +0100 Subject: [PATCH 2/2] Update cmddata.c as suggested, a bitwise bounds check in cmddata. --- client/cmddata.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client/cmddata.c b/client/cmddata.c index cf4dc6b9b..25d752f6a 100644 --- a/client/cmddata.c +++ b/client/cmddata.c @@ -57,9 +57,8 @@ void printDemodBuff() } if (bitLen>512) bitLen=512; //max output to 512 bits if we have more - should be plenty - // equally divided by 16 - if ( bitLen % 16 > 0) - bitLen = (bitLen/16); + // ensure equally divided by 16 + bitLen &= 0xfff0; for (i = 0; i <= (bitLen-16); i+=16) { PrintAndLog("%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i", @@ -193,6 +192,11 @@ void printBitStream(uint8_t BitStream[], uint32_t bitLen) return; } if (bitLen>512) bitLen=512; + + // ensure equally divided by 16 + bitLen &= 0xfff0; + + for (i = 0; i <= (bitLen-16); i+=16) { PrintAndLog("%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i", BitStream[i],