From 4cc6d3858d1695e35673e6a627e6f5906e0b38a3 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Sun, 12 Apr 2020 21:23:52 +0200 Subject: [PATCH 1/2] fix: no error message when para was zero --- client/cliparser/cliparser.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client/cliparser/cliparser.c b/client/cliparser/cliparser.c index 4e0fb4d9c..6e11d632c 100644 --- a/client/cliparser/cliparser.c +++ b/client/cliparser/cliparser.c @@ -157,11 +157,14 @@ int CLIParamHexToBuf(struct arg_str *argstr, uint8_t *data, int maxdatalen, int int ibuf = 0; uint8_t tmp_buf[256] = {0}; int res = CLIParamStrToBuf(argstr, tmp_buf, maxdatalen * 2, &ibuf); // *2 because here HEX - if (res || !ibuf){ + if (res) { printf("Parameter error: buffer overflow.\n"); fflush(stdout); return res; } + if (ibuf == 0) { + return res; + } switch (param_gethex_to_eol((char *)tmp_buf, 0, data, maxdatalen, datalen)) { case 1: @@ -199,12 +202,13 @@ int CLIParamStrToBuf(struct arg_str *argstr, uint8_t *data, int maxdatalen, int if (!ibuf) return 0; - if (ibuf > maxdatalen) + if (ibuf > maxdatalen) { + fflush(stdout); return 2; + } memcpy(data, tmp_buf, ibuf); *datalen = ibuf; - return 0; } From 99d7a0a1c96ba6eb24fd7be1984ab107deda43b1 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Sun, 12 Apr 2020 21:27:32 +0200 Subject: [PATCH 2/2] chg: hf mfu ndef - better message when failed to find a mfu tag --- client/cmdhfmfu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/cmdhfmfu.c b/client/cmdhfmfu.c index fd3ad5aeb..2513f7122 100644 --- a/client/cmdhfmfu.c +++ b/client/cmdhfmfu.c @@ -2734,7 +2734,6 @@ static int CmdHF14MfuNDEF(const char *Cmd) { arg_param_end }; CLIExecWithReturn(Cmd, argtable, true); - CLIGetHexWithReturn(1, key, &keylen); swapEndian = arg_get_lit(2); CLIParserFree(); @@ -2753,7 +2752,10 @@ static int CmdHF14MfuNDEF(const char *Cmd) { // Get tag type TagTypeUL_t tagtype = GetHF14AMfU_Type(); - if (tagtype == UL_ERROR) return PM3_ESOFT; + if (tagtype == UL_ERROR) { + PrintAndLogEx(WARNING, "No Ultraligth / NTAG based tag found"); + return PM3_ESOFT; + } // Is tag UL/NTAG?