]> granicus.if.org Git - esp-idf/commitdiff
components/mdns: wrong Message compression detect
authorSiarhei Volkau <lis8215@gmail.com>
Fri, 27 Oct 2017 07:22:01 +0000 (10:22 +0300)
committerIvan Grokhotkov <ivan@espressif.com>
Fri, 3 Nov 2017 08:52:22 +0000 (16:52 +0800)
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.

components/mdns/mdns.c

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