summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2015-07-23 08:53:36 +0200
committerDaniel Mack <github@zonque.org>2015-07-23 08:53:36 +0200
commit33b63dd732b8ab04fb40b8d1f7d154ab4ba39fed (patch)
tree96d7ff1500c36ae9996429720df2edcc2db47320 /src
parent2d3102cc401ff743e23be5202cfbaa52dcad8e4d (diff)
parent6fa919016a321b89e59363da92d4cf8ec5e45f8b (diff)
Merge pull request #673 from poettering/dns-packet-append-type-window
resolved: make sure we alway initialize *start in dns_packet_append_t…
Diffstat (limited to 'src')
-rw-r--r--src/resolve/resolved-dns-packet.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/resolve/resolved-dns-packet.c b/src/resolve/resolved-dns-packet.c
index b1cde4ab35..12cd524c40 100644
--- a/src/resolve/resolved-dns-packet.c
+++ b/src/resolve/resolved-dns-packet.c
@@ -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;