From 8363144dbf9b8d7c2333ab4d62d08d454ea890b3 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Mon, 26 Feb 2024 13:49:13 +0600 Subject: [PATCH] More validation --- src/device/novell_cardkey.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/device/novell_cardkey.c b/src/device/novell_cardkey.c index 54b716cc3..9f489cad7 100644 --- a/src/device/novell_cardkey.c +++ b/src/device/novell_cardkey.c @@ -73,6 +73,14 @@ void* novell_cardkey_init(const device_t* info) if (sernumstr[i] > '8' || sernumstr[i] < '0') sernumstr[i] = '0'; } + if (sernumstr[8] > 'F' || sernumstr[8] < '0') + sernumstr[8] = '0'; + if (sernumstr[9] > 'F' || sernumstr[9] < '0') + sernumstr[9] = '0'; + if (sernumstr[10] > 'F' || sernumstr[10] < '0') + sernumstr[10] = '0'; + if (sernumstr[11] > 'F' || sernumstr[11] < '0') + sernumstr[11] = '0'; sernumstr[12] = 0; strncpy(cardkey->serial_number_str, sernumstr, sizeof(sernumstr)); io_sethandler(NOVELL_KEYCARD_ADDR, NOVELL_KEYCARD_ADDRLEN, novell_cardkey_read, NULL, NULL, NULL, NULL, NULL, cardkey);