]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: packet - fix read_type_window()
authorTom Gundersen <teg@jklm.no>
Tue, 28 Jul 2015 21:10:18 +0000 (23:10 +0200)
committerTom Gundersen <teg@jklm.no>
Tue, 28 Jul 2015 21:25:52 +0000 (23:25 +0200)
We were tracking the bit offset inside each byte, rather than inside the whole bitmap.

src/resolve/resolved-dns-packet.c

index 8c5306cc8318ced57f22d9e4c591e35f6e2a7f0b..88a3089a72888007868db6b97678dd06575d04f9 100644 (file)
@@ -1156,6 +1156,7 @@ static int dns_packet_read_type_window(DnsPacket *p, Bitmap **types, size_t *sta
         uint8_t window;
         uint8_t length;
         const uint8_t *bitmap;
+        uint8_t bit = 0;
         unsigned i;
         bool found = false;
         size_t saved_rindex;
@@ -1187,10 +1188,10 @@ static int dns_packet_read_type_window(DnsPacket *p, Bitmap **types, size_t *sta
 
         for (i = 0; i < length; i++) {
                 uint8_t bitmask = 1 << 7;
-                uint8_t bit = 0;
 
                 if (!bitmap[i]) {
                         found = false;
+                        bit += 8;
                         continue;
                 }