From: merlokk Date: Tue, 11 Sep 2018 11:56:33 +0000 (+0300) Subject: `hf emv select` some refactoring X-Git-Tag: v3.1.0~9^2~16 X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/7d4ba60e8e1b169822ff64a870b9f976585cb97c `hf emv select` some refactoring --- diff --git a/client/cliparser/cliparser.c b/client/cliparser/cliparser.c index 0e70a630..87427db0 100644 --- a/client/cliparser/cliparser.c +++ b/client/cliparser/cliparser.c @@ -148,6 +148,10 @@ void CLIParserFree() { // convertors int CLIParamHexToBuf(struct arg_str *argstr, uint8_t *data, int maxdatalen, int *datalen) { + *datalen = 0; + if (!strlen(argstr->sval[0])) + return 0; + switch(param_gethex_to_eol(argstr->sval[0], 0, data, maxdatalen, datalen)) { case 1: printf("Parameter error: Invalid HEX value.\n"); diff --git a/client/emv/cmdemv.c b/client/emv/cmdemv.c index c40a9a69..33a519b1 100644 --- a/client/emv/cmdemv.c +++ b/client/emv/cmdemv.c @@ -51,8 +51,7 @@ int CmdHFEMVSelect(const char *cmd) { bool leaveSignalON = arg_get_lit(2); bool APDULogging = arg_get_lit(3); bool decodeTLV = arg_get_lit(4); - if (arg_get_str_len(5)) - CLIGetStrBLessWithReturn(5, data, &datalen, 0); + CLIGetStrBLessWithReturn(5, data, &datalen, 0); CLIParserFree(); SetAPDULogging(APDULogging);