mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
coverty 290397, 290399
This commit is contained in:
parent
307e39bb22
commit
d0b22cbd95
1 changed files with 13 additions and 1 deletions
|
@ -201,12 +201,14 @@ static int CmdHFFidoRegister(const char *cmd) {
|
||||||
CLIGetStrWithReturn(ctx, 6, cdata, &chlen);
|
CLIGetStrWithReturn(ctx, 6, cdata, &chlen);
|
||||||
if (chlen > 16) {
|
if (chlen > 16) {
|
||||||
PrintAndLogEx(ERR, "ERROR: challenge parameter length in ASCII mode must be less than 16 chars instead of: %d", chlen);
|
PrintAndLogEx(ERR, "ERROR: challenge parameter length in ASCII mode must be less than 16 chars instead of: %d", chlen);
|
||||||
|
CLIParserFree(ctx);
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CLIGetHexWithReturn(ctx, 6, cdata, &chlen);
|
CLIGetHexWithReturn(ctx, 6, cdata, &chlen);
|
||||||
if (chlen && chlen != 32) {
|
if (chlen && chlen != 32) {
|
||||||
PrintAndLogEx(ERR, "ERROR: challenge parameter length must be 32 bytes only.");
|
PrintAndLogEx(ERR, "ERROR: challenge parameter length must be 32 bytes only.");
|
||||||
|
CLIParserFree(ctx);
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,12 +221,14 @@ static int CmdHFFidoRegister(const char *cmd) {
|
||||||
CLIGetStrWithReturn(ctx, 7, adata, &applen);
|
CLIGetStrWithReturn(ctx, 7, adata, &applen);
|
||||||
if (applen > 16) {
|
if (applen > 16) {
|
||||||
PrintAndLogEx(ERR, "ERROR: application parameter length in ASCII mode must be less than 16 chars instead of: %d", applen);
|
PrintAndLogEx(ERR, "ERROR: application parameter length in ASCII mode must be less than 16 chars instead of: %d", applen);
|
||||||
|
CLIParserFree(ctx);
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CLIGetHexWithReturn(ctx, 7, adata, &applen);
|
CLIGetHexWithReturn(ctx, 7, adata, &applen);
|
||||||
if (applen && applen != 32) {
|
if (applen && applen != 32) {
|
||||||
PrintAndLogEx(ERR, "ERROR: application parameter length must be 32 bytes only.");
|
PrintAndLogEx(ERR, "ERROR: application parameter length must be 32 bytes only.");
|
||||||
|
CLIParserFree(ctx);
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -446,8 +450,10 @@ static int CmdHFFidoAuthenticate(const char *cmd) {
|
||||||
CLIGetHexWithReturn(ctx, 8, hdata, &hdatalen);
|
CLIGetHexWithReturn(ctx, 8, hdata, &hdatalen);
|
||||||
if (hdatalen && hdatalen != 65) {
|
if (hdatalen && hdatalen != 65) {
|
||||||
PrintAndLogEx(ERR, "ERROR: public key length must be 65 bytes only.");
|
PrintAndLogEx(ERR, "ERROR: public key length must be 65 bytes only.");
|
||||||
|
CLIParserFree(ctx);
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hdatalen) {
|
if (hdatalen) {
|
||||||
memmove(public_key, hdata, hdatalen);
|
memmove(public_key, hdata, hdatalen);
|
||||||
public_key_loaded = true;
|
public_key_loaded = true;
|
||||||
|
@ -456,8 +462,10 @@ static int CmdHFFidoAuthenticate(const char *cmd) {
|
||||||
CLIGetHexWithReturn(ctx, 9, hdata, &hdatalen);
|
CLIGetHexWithReturn(ctx, 9, hdata, &hdatalen);
|
||||||
if (hdatalen > 255) {
|
if (hdatalen > 255) {
|
||||||
PrintAndLogEx(ERR, "ERROR: application parameter length must be less than 255.");
|
PrintAndLogEx(ERR, "ERROR: application parameter length must be less than 255.");
|
||||||
|
CLIParserFree(ctx);
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hdatalen) {
|
if (hdatalen) {
|
||||||
keyHandleLen = hdatalen;
|
keyHandleLen = hdatalen;
|
||||||
data[64] = keyHandleLen;
|
data[64] = keyHandleLen;
|
||||||
|
@ -469,15 +477,18 @@ static int CmdHFFidoAuthenticate(const char *cmd) {
|
||||||
CLIGetStrWithReturn(ctx, 9, hdata, &hdatalen);
|
CLIGetStrWithReturn(ctx, 9, hdata, &hdatalen);
|
||||||
if (hdatalen > 16) {
|
if (hdatalen > 16) {
|
||||||
PrintAndLogEx(ERR, "ERROR: challenge parameter length in ASCII mode must be less than 16 chars instead of: %d", hdatalen);
|
PrintAndLogEx(ERR, "ERROR: challenge parameter length in ASCII mode must be less than 16 chars instead of: %d", hdatalen);
|
||||||
|
CLIParserFree(ctx);
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CLIGetHexWithReturn(ctx, 10, hdata, &hdatalen);
|
CLIGetHexWithReturn(ctx, 10, hdata, &hdatalen);
|
||||||
if (hdatalen && hdatalen != 32) {
|
if (hdatalen && hdatalen != 32) {
|
||||||
PrintAndLogEx(ERR, "ERROR: challenge parameter length must be 32 bytes only.");
|
PrintAndLogEx(ERR, "ERROR: challenge parameter length must be 32 bytes only.");
|
||||||
|
CLIParserFree(ctx);
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hdatalen)
|
if (hdatalen)
|
||||||
memmove(data, hdata, 32);
|
memmove(data, hdata, 32);
|
||||||
|
|
||||||
|
@ -497,6 +508,7 @@ static int CmdHFFidoAuthenticate(const char *cmd) {
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hdatalen)
|
if (hdatalen)
|
||||||
memmove(&data[32], hdata, 32);
|
memmove(&data[32], hdata, 32);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue