]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdhf14a.c
FIX: Coverity, Unintended sign extension, data[7] would have become int, then uint64_...
[proxmark3-svn] / client / cmdhf14a.c
index f94296c0a00c06e46334ebff1d0b7dc955c00894..ea2224488f9b13e82a14343459da784cbe5a214e 100644 (file)
@@ -25,6 +25,7 @@
 #include "mifare.h"
 #include "cmdhfmfu.h"
 #include "nonce2key/nonce2key.h"
+#include "cmdhf.h"
 
 #define llx PRIx64
 
@@ -171,7 +172,8 @@ int usage_hf_14a_raw(void){
 
 int CmdHF14AList(const char *Cmd)
 {
-       PrintAndLog("Deprecated command, use 'hf list 14a' instead");
+       //PrintAndLog("Deprecated command, use 'hf list 14a' instead");
+       CmdHFList("14a");
        return 0;
 }
 
@@ -729,9 +731,11 @@ int CmdHF14ACmdRaw(const char *cmd) {
 
        if(topazmode)
                c.arg[0] |= ISO14A_TOPAZMODE;
-               
+                       
        // Max buffer is USB_CMD_DATA_SIZE
-    c.arg[1] = (datalen & 0xFFFF) | (numbits << 16);
+       datalen = (datalen > USB_CMD_DATA_SIZE) ? USB_CMD_DATA_SIZE : datalen;
+               
+    c.arg[1] = (datalen & 0xFFFF) | (uint32_t)(numbits << 16);
     memcpy(c.d.asBytes,data,datalen);
 
        clearCommandBuffer();
@@ -786,7 +790,8 @@ static command_t CommandTable[] =
 
 int CmdHF14A(const char *Cmd) {
        // flush
-       WaitForResponseTimeout(CMD_ACK,NULL,100);
+       clearCommandBuffer();
+       //WaitForResponseTimeout(CMD_ACK,NULL,100);
 
        // parse
        CmdsParse(CommandTable, Cmd);
Impressum, Datenschutz