components/mdns: wrong Message compression detect

Old behavior assumes message compressed when any of 2 most significant bits are set,
But in fact Message compressed only when both those bits are set to 1.

Also maximal label length should be 63 bytes.
This commit is contained in:
Siarhei Volkau 2017-10-27 10:22:01 +03:00 committed by Ivan Grokhotkov
parent 5827fd8c71
commit 6e24566186

View file

@ -555,9 +555,9 @@ static const uint8_t * _mdns_read_fqdn(const uint8_t * packet, const uint8_t * s
return NULL; return NULL;
} }
uint8_t len = start[index++]; uint8_t len = start[index++];
if ((len & 0xC0) == 0) { if (len < 0xC0) {
if (len > 64) { if (len > 63) {
//length can not be more than 64 //length can not be more than 63
return NULL; return NULL;
} }
uint8_t i; uint8_t i;