diff --git a/client/cliparser/cliparser.c b/client/cliparser/cliparser.c index 0e70a630..9f185837 100644 --- a/client/cliparser/cliparser.c +++ b/client/cliparser/cliparser.c @@ -99,7 +99,7 @@ int CLIParserParseString(const char* str, void* vargtable[], size_t vargtableLen for (int i = 0; i < len; i++) { switch(state){ case PS_FIRST: // first char - if (str[i] == '-'){ // first char before space is '-' - next element - option + if (true/*str[i] == '-'*/){ // first char before space is '-' - next element - option state = PS_OPTION; if (spaceptr) { @@ -148,7 +148,21 @@ void CLIParserFree() { // convertors int CLIParamHexToBuf(struct arg_str *argstr, uint8_t *data, int maxdatalen, int *datalen) { - switch(param_gethex_to_eol(argstr->sval[0], 0, data, maxdatalen, datalen)) { + *datalen = 0; + if (!argstr->count) + return 0; + + char buf[256] = {0}; + int ibuf = 0; + + for (int i = 0; i < argstr->count; i++) { + int len = strlen(argstr->sval[i]); + memcpy(&buf[ibuf], argstr->sval[i], len); + ibuf += len; + } + buf[ibuf] = 0; + + switch(param_gethex_to_eol(buf, 0, data, maxdatalen, datalen)) { case 1: printf("Parameter error: Invalid HEX value.\n"); return 1; diff --git a/client/cmdhf14a.c b/client/cmdhf14a.c index 2d76f109..6b271feb 100644 --- a/client/cmdhf14a.c +++ b/client/cmdhf14a.c @@ -807,7 +807,7 @@ int CmdHF14ACmdRaw(const char *cmd) { arg_int0("t", "timeout", NULL, "timeout in ms"), arg_lit0("T", "topaz", "use Topaz protocol to send command"), arg_lit0("3", NULL, "ISO14443-3 select only (skip RATS)"), - arg_str1(NULL, NULL, "", NULL), + arg_strn(NULL, NULL, "", 1, 250, NULL), arg_param_end }; // defaults