From 137b0a63e87157a1c4e383c4f65298c3a44e27a4 Mon Sep 17 00:00:00 2001 From: Simon Hailes Date: Wed, 17 Feb 2021 20:01:12 +0000 Subject: [PATCH] fix ble from accepting 12 char alias whcih does not match as a mac address --- tasmota/xdrv_79_esp32_ble.ino | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tasmota/xdrv_79_esp32_ble.ino b/tasmota/xdrv_79_esp32_ble.ino index c9586a45e..5775c3016 100644 --- a/tasmota/xdrv_79_esp32_ble.ino +++ b/tasmota/xdrv_79_esp32_ble.ino @@ -1015,6 +1015,18 @@ int fromHex(uint8_t *dest, const char *src, int maxlen){ t[0] = src[i*2]; t[1] = src[i*2 + 1]; t[2] = 0; + t[0] |= 0x20; + t[1] |= 0x20; + if (isalpha(t[0])){ + if (t[0] < 'a' || t[0] > 'f'){ + return 0; + } + } + if (isalpha(t[1])){ + if (t[1] < 'a' || t[1] > 'f'){ + return 0; + } + } int byte = strtol(t, NULL, 16); *dest++ = byte;