`hf emv select` some refactoring
authormerlokk <olegmsn@gmail.com>
Tue, 11 Sep 2018 11:56:33 +0000 (14:56 +0300)
committermerlokk <olegmsn@gmail.com>
Tue, 11 Sep 2018 11:56:33 +0000 (14:56 +0300)
client/cliparser/cliparser.c
client/emv/cmdemv.c

index 0e70a630a56e82ae0f8392847c99f839290d12ca..87427db0a942861d14bf3fa0b0787395526cdfbc 100644 (file)
@@ -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");
index c40a9a69b3544d1861001bdaedea09c0664213cb..33a519b14e0c261c057be6668490d5874554c59a 100644 (file)
@@ -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);
Impressum, Datenschutz