From fdba7c2ff8aa7c75a38acd1034fd4f6be4aca648 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Sun, 22 Aug 2021 17:02:44 +0200 Subject: [PATCH] Safe check in sprint_bytebits_bin_break --- client/src/util.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/src/util.c b/client/src/util.c index d45875cef..65694db18 100644 --- a/client/src/util.c +++ b/client/src/util.c @@ -313,10 +313,14 @@ char *sprint_bytebits_bin_break(const uint8_t *data, const size_t len, const uin char c = data[i]; // manchester wrong bit marker - if (c == 7) + if (c == 7) { c = '.'; - else + } else if (c < 2) { c += '0'; + } else { + PrintAndLogEx(ERR, "Invalid data passed to sprint_bytebits_bin_break()"); + return buf; + } *(tmp++) = c;