down to precisely 300 problems

This commit is contained in:
Doridian 2022-06-10 13:16:04 -07:00
commit 107bfe469a
3 changed files with 13 additions and 9 deletions

View file

@ -372,11 +372,15 @@ static int CmdHFFidoRegister(const char *cmd) {
PrintAndLogEx(INFO, ""); PrintAndLogEx(INFO, "");
PrintAndLogEx(INFO, "auth command: "); PrintAndLogEx(INFO, "auth command: ");
char command[500] = {0}; char command[500] = {0};
sprintf(command, "hf fido auth --kh %s", sprint_hex_inrow(&buf[67], keyHandleLen)); snprintf(command, sizeof(command), "hf fido auth --kh %s", sprint_hex_inrow(&buf[67], keyHandleLen));
if (chlen) if (chlen) {
sprintf(command + strlen(command), " --%s %s", cpplain ? "cp" : "cpx", cpplain ? (char *)cdata : sprint_hex_inrow(cdata, 32)); size_t command_len = strlen(command);
if (applen) snprintf(command + command_len, sizeof(command) - command_len, " --%s %s", cpplain ? "cp" : "cpx", cpplain ? (char *)cdata : sprint_hex_inrow(cdata, 32));
sprintf(command + strlen(command), " --%s %s", applain ? "cp" : "cpx", applain ? (char *)adata : sprint_hex_inrow(adata, 32)); }
if (applen) {
size_t command_len = strlen(command);
snprintf(command + command_len, sizeof(command) - command_len, " --%s %s", applain ? "cp" : "cpx", applain ? (char *)adata : sprint_hex_inrow(adata, 32));
}
PrintAndLogEx(INFO, "%s", command); PrintAndLogEx(INFO, "%s", command);
if (root) { if (root) {

View file

@ -1521,10 +1521,11 @@ static void mf_get_paritybinstr(char *s, uint32_t val, uint8_t par) {
num_to_bytes(val, sizeof(uint32_t), foo); num_to_bytes(val, sizeof(uint32_t), foo);
for (uint8_t i = 0; i < 4; i++) { for (uint8_t i = 0; i < 4; i++) {
if (oddparity8(foo[i]) != ((par >> (7 - (i & 0x0007))) & 0x01)) if (oddparity8(foo[i]) != ((par >> (7 - (i & 0x0007))) & 0x01))
sprintf(s++, "1"); *(s++) = '1';
else else
sprintf(s++, "0"); *(s++) = '0';
} }
s[0] = '\0';
} }
bool DecodeMifareData(uint8_t *cmd, uint8_t cmdsize, uint8_t *parity, bool isResponse, uint8_t *mfData, size_t *mfDataLen, const uint64_t *dicKeys, uint32_t dicKeysCount) { bool DecodeMifareData(uint8_t *cmd, uint8_t cmdsize, uint8_t *parity, bool isResponse, uint8_t *mfData, size_t *mfDataLen, const uint64_t *dicKeys, uint32_t dicKeysCount) {

View file

@ -683,8 +683,7 @@ static int CmdHfLTODump(const char *Cmd) {
} }
if (strlen(filename) == 0) { if (strlen(filename) == 0) {
char *fptr = filename; char *fptr = filename + snprintf(filename, sizeof(filename), "hf-lto-");
fptr += sprintf(fptr, "hf-lto-");
FillFileNameByUID(fptr, dump, "-dump", 5); FillFileNameByUID(fptr, dump, "-dump", 5);
} }
saveFile(filename, ".bin", dump, dump_len); saveFile(filename, ".bin", dump, dump_len);