mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-11-11 01:55:38 +08:00
fix: no error message when para was zero
This commit is contained in:
parent
682bded18a
commit
4cc6d3858d
1 changed files with 7 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue