From ae7b0de2c9965156c3bb692cf627c3a428792430 Mon Sep 17 00:00:00 2001 From: Matthias Konrath Date: Wed, 28 Aug 2019 09:49:21 +0200 Subject: [PATCH] Fixed a typo and added and improved the checks for the returned data of loadFileDICTIONARY_safe. --- client/cmdlft55xx.c | 2 +- client/fileutils.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/cmdlft55xx.c b/client/cmdlft55xx.c index f256a5ee3..48baea594 100644 --- a/client/cmdlft55xx.c +++ b/client/cmdlft55xx.c @@ -2129,7 +2129,7 @@ static int CmdT55xxChkPwds(const char *Cmd) { uint16_t keycount = 0; int res = loadFileDICTIONARY_safe(filename, &keyBlock, 4, &keycount); - if (res || keycount == 0 || keyBlock == NULL) { + if (res || keycount <= 0 || keyBlock == NULL) { PrintAndLogEx(WARNING, "No keys found in file"); if (keyBlock != NULL) free(keyBlock); return PM3_ESOFT; diff --git a/client/fileutils.h b/client/fileutils.h index b2c16c282..1428c0d8c 100644 --- a/client/fileutils.h +++ b/client/fileutils.h @@ -163,7 +163,7 @@ int loadFileJSON(const char *preferredName, void *data, size_t maxdatalen, size_ int loadFileDICTIONARY(const char *preferredName, void *data, size_t *datalen, uint8_t keylen, uint16_t *keycnt); /** - * @brief Utility function to load data from a DICTIONARY safely into a textfile. This method takes a preferred name. + * @brief Utility function to load data safely from a DICTIONARY textfile. This method takes a preferred name. * E.g. mfc_default_keys.dic * * @param preferredName