From 242c276bfb66b6ff79f3276b945f0693a1a29018 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Tue, 9 Jun 2020 18:45:37 +0200 Subject: [PATCH] mfc mad_print compare --- client/src/mifare/mad.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/client/src/mifare/mad.c b/client/src/mifare/mad.c index d0838877a..c3007026b 100644 --- a/client/src/mifare/mad.c +++ b/client/src/mifare/mad.c @@ -99,19 +99,23 @@ static int mad_print(json_t **xroot, char *mad, bool verbose, char *out) { PrintAndLogEx(ERR, "data [%d] is not an object\n", idx); continue; } - + const char *fmad = mad_json_get_str(data, "mad"); if (strcmp(mad, fmad) == 0) { elm = data; break; } - char lmad[strlen(mad)]; + + char lfmad[strlen(fmad) + 1]; + strcpy(lfmad, fmad); + str_lower(lfmad); + char lmad[strlen(mad) + 1]; strcpy(lmad, mad); str_lower(lmad); - if (strcmp(lmad, fmad) == 0) { + if (strcmp(lmad, lfmad) == 0) { elm = data; break; - } + } } if (elm == NULL)