]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmddata.c
Merge branch 'master' of https://github.com/Proxmark/proxmark3
[proxmark3-svn] / client / cmddata.c
index 95c7dc87bc2df5a46758ec7fbbaf383d3aa38c2a..cea3bcfee9a7b4c46182d1c3cfc66ef0778603f3 100644 (file)
@@ -32,6 +32,12 @@ static int CmdHelp(const char *Cmd);
 //by marshmellow
 void setDemodBuf(uint8_t *buff, size_t size, size_t startIdx)
 {
+       if (buff == NULL) 
+               return;
+       
+       if ( size >= MAX_DEMOD_BUF_LEN)
+               size = MAX_DEMOD_BUF_LEN;
+       
        size_t i = 0;
        for (; i < size; i++){
                DemodBuffer[i]=buff[startIdx++];
@@ -1033,7 +1039,7 @@ int FSKrawDemod(const char *Cmd, bool verbose)
     if(size > (8*32)+2) size = (8*32)+2; //only output a max of 8 blocks of 32 bits  most tags will have full bit stream inside that sample size
     if (verbose) {
       PrintAndLog("FSK decoded bitstream:");
-      printBitStream(BitStream,size);
+    printBitStream(BitStream,size);
     }
 
     return 1;
@@ -1780,7 +1786,8 @@ int NRZrawDemod(const char *Cmd, bool verbose)
     if (g_debugMode==1 && verbose) PrintAndLog("no data found, clk: %d, invert: %d, numbits: %d, errCnt: %d",clk,invert,BitLen,errCnt);
     return 0;
   }
-  PrintAndLog("Tried NRZ Demod using Clock: %d - invert: %d - Bits Found: %d",clk,invert,BitLen);
+  if (verbose) 
+       PrintAndLog("Tried NRZ Demod using Clock: %d - invert: %d - Bits Found: %d",clk,invert,BitLen);
   //prime demod buffer for output
   setDemodBuf(BitStream,BitLen,0);
 
@@ -1788,9 +1795,9 @@ int NRZrawDemod(const char *Cmd, bool verbose)
     PrintAndLog("# Errors during Demoding (shown as 77 in bit stream): %d",errCnt);
   }
   if (verbose) {
-    PrintAndLog("NRZ demoded bitstream:");
-    // Now output the bitstream to the scrollback by line of 16 bits
-    printDemodBuff();
+  PrintAndLog("NRZ demoded bitstream:");
+  // Now output the bitstream to the scrollback by line of 16 bits
+  printDemodBuff();
   }
   return 1; 
 }
Impressum, Datenschutz