]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdhf14a.c
FIX, Coverity, Unsigned compared against 0. CID #212326, keyNBr will never be negative.
[proxmark3-svn] / client / cmdhf14a.c
index 8d15f73142494390c69b9129313bad559cdfbbe2..ea2224488f9b13e82a14343459da784cbe5a214e 100644 (file)
@@ -731,9 +731,11 @@ int CmdHF14ACmdRaw(const char *cmd) {
 
        if(topazmode)
                c.arg[0] |= ISO14A_TOPAZMODE;
 
        if(topazmode)
                c.arg[0] |= ISO14A_TOPAZMODE;
-               
+                       
        // Max buffer is USB_CMD_DATA_SIZE
        // 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();
     memcpy(c.d.asBytes,data,datalen);
 
        clearCommandBuffer();
@@ -788,7 +790,8 @@ static command_t CommandTable[] =
 
 int CmdHF14A(const char *Cmd) {
        // flush
 
 int CmdHF14A(const char *Cmd) {
        // flush
-       WaitForResponseTimeout(CMD_ACK,NULL,100);
+       clearCommandBuffer();
+       //WaitForResponseTimeout(CMD_ACK,NULL,100);
 
        // parse
        CmdsParse(CommandTable, Cmd);
 
        // parse
        CmdsParse(CommandTable, Cmd);
Impressum, Datenschutz