Merge pull request #25 from RfidResearchGroup/master

Update
This commit is contained in:
Bjoern Kerler 2020-04-12 21:29:33 +02:00 committed by GitHub
commit 11ca483617
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View file

@ -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;
}

View file

@ -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?