]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdcrc.c
Merge branch 'master' into fix_printf
[proxmark3-svn] / client / cmdcrc.c
index 0536529890c1dc221a80057d073b79f4702807a6..0ca2b8b1e00d816223d991f49d23978dc8f10739 100644 (file)
@@ -8,7 +8,6 @@
 // CRC Calculations from the software reveng commands
 //-----------------------------------------------------------------------------
 
-#include <stdlib.h>
 #ifdef _WIN32
 #  include <io.h>
 #  include <fcntl.h>
@@ -19,8 +18,8 @@
 
 #include <stdio.h>
 #include <string.h>
-//#include <stdlib.h>
-//#include <ctype.h>
+#include <stdlib.h>
+#include <ctype.h>
 #include "cmdmain.h"
 #include "cmdcrc.h"
 #include "reveng/reveng.h"
@@ -41,13 +40,14 @@ int split(char *str, char *arr[MAX_ARGS]){
        int wordCnt = 0;
 
        while(1){
-               while(isspace(str[beginIndex])){
+               while(isspace((unsigned char)str[beginIndex])){
                        ++beginIndex;
                }
-               if(str[beginIndex] == '\0')
+               if(str[beginIndex] == '\0') {
                        break;
-                       endIndex = beginIndex;
-               while (str[endIndex] && !isspace(str[endIndex])){
+               }
+               endIndex = beginIndex;
+               while (str[endIndex] && !isspace((unsigned char)str[endIndex])){
                        ++endIndex;
                }
                int len = endIndex - beginIndex;
@@ -434,9 +434,9 @@ int CmdrevengTestC(const char *Cmd){
        char result[30];
        int dataLen;
        char endian = 0;
-       dataLen = param_getstr(Cmd, cmdp++, inModel);
+       dataLen = param_getstr(Cmd, cmdp++, inModel, sizeof(inModel));
        if (dataLen < 4) return 0;
-       dataLen = param_getstr(Cmd, cmdp++, inHexStr);
+       dataLen = param_getstr(Cmd, cmdp++, inHexStr, sizeof(inHexStr));
        if (dataLen < 4) return 0;
        bool reverse = (param_get8(Cmd, cmdp++)) ? true : false;
        endian = param_getchar(Cmd, cmdp++); 
@@ -464,7 +464,7 @@ char *SwapEndianStr(const char *inStr, const size_t len, const uint8_t blockSize
 // takes hex string in and searches for a matching result (hex string must include checksum)
 int CmdrevengSearch(const char *Cmd){
        char inHexStr[50] = {0x00};
-       int dataLen = param_getstr(Cmd, 0, inHexStr);
+       int dataLen = param_getstr(Cmd, 0, inHexStr, sizeof(inHexStr));
        if (dataLen < 4) return 0;
 
        char *Models[80];
Impressum, Datenschutz