mirror of https://github.com/arendst/Tasmota.git
Merge pull request #11011 from btsimonh/blefromhex
fix ble from accepting 12 char alias which does not match as a mac ad…
This commit is contained in:
commit
e335e9244b
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue