]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: make sure we alway initialize *start in dns_packet_append_type_window() 673/head
authorLennart Poettering <lennart@poettering.net>
Thu, 23 Jul 2015 02:54:35 +0000 (04:54 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 23 Jul 2015 02:54:35 +0000 (04:54 +0200)
src/resolve/resolved-dns-packet.c

index b1cde4ab35e26ccb43353c4df5f44c4052cadb59..12cd524c40ffd77df05ef414b53520f949c88728 100644 (file)
@@ -509,22 +509,22 @@ static int dns_packet_append_type_window(DnsPacket *p, uint8_t window, uint8_t l
         assert(p);
         assert(types);
 
-        if (length == 0)
-                return 0;
-
         saved_size = p->size;
 
-        r = dns_packet_append_uint8(p, window, NULL);
-        if (r < 0)
-                goto fail;
+        if (length != 0) {
 
-        r = dns_packet_append_uint8(p, length, NULL);
-        if (r < 0)
-                goto fail;
+                r = dns_packet_append_uint8(p, window, NULL);
+                if (r < 0)
+                        goto fail;
 
-        r = dns_packet_append_blob(p, types, length, NULL);
-        if (r < 0)
-                goto fail;
+                r = dns_packet_append_uint8(p, length, NULL);
+                if (r < 0)
+                        goto fail;
+
+                r = dns_packet_append_blob(p, types, length, NULL);
+                if (r < 0)
+                        goto fail;
+        }
 
         if (start)
                 *start = saved_size;