cppcheck fix - array out of bounds. last item is null reduce 1 from arr len, zero based index reduce -1 to get index....\n also made the compare caseinsensitive

This commit is contained in:
iceman1001 committed 2022-01-10 22:29:57 +01:00
1 parent 21061d6d55
commit 221a06321b
3 files changed
+19 -13

No files matched your search

+3 -3
View File
@@ -279,7 +279,7 @@ static int CmdHIDSim(const char *Cmd) {
memset(&packed, 0, sizeof(wiegand_message_t));
// format validation
int format_idx = HIDFindCardFormat((char *)format);
int format_idx = HIDFindCardFormat(format);
if (format_idx == -1 && raw_len == 0) {
PrintAndLogEx(WARNING, "Unknown format: " _YELLOW_("%s"), format);
return PM3_EINVARG;
@@ -383,7 +383,7 @@ static int CmdHIDClone(const char *Cmd) {
memset(&packed, 0, sizeof(wiegand_message_t));
// format validation
int format_idx = HIDFindCardFormat((char *)format);
int format_idx = HIDFindCardFormat(format);
if (format_idx == -1 && raw_len == 0) {
PrintAndLogEx(WARNING, "Unknown format: " _YELLOW_("%s"), format);
return PM3_EINVARG;
@@ -509,7 +509,7 @@ static int CmdHIDBrute(const char *Cmd) {
formatLen = sizeof(format);
CLIGetStrWithReturn(ctx, 2, format, &formatLen);
format_idx = HIDFindCardFormat((char *) format);
format_idx = HIDFindCardFormat(format);
if (format_idx == -1) {
PrintAndLogEx(WARNING, "Unknown format: " _YELLOW_("%s"), format);
CLIParserFree(ctx);