diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-08-21 16:04:59 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-08-21 16:04:59 +0200 |
commit | f6a5fec6b971e2a8c69d92ab20ed13693be82ddb (patch) | |
tree | 1d44bb4d68bdebb78f875d860ea086bba46c03fe /src/resolve/resolved-dns-packet.c | |
parent | ef7051360aefca01d20f700ee74ac1baced59879 (diff) |
resolved: when passing RRs across the bus, make sure not to use name compression
We explicitly need to turn off name compression when marshalling or
demarshalling RRs for bus transfer, since they otherwise refer to packet
offsets that reference packets that are not transmitted themselves.
Diffstat (limited to 'src/resolve/resolved-dns-packet.c')
-rw-r--r-- | src/resolve/resolved-dns-packet.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/resolve/resolved-dns-packet.c b/src/resolve/resolved-dns-packet.c index ad337c2714..bebd1ee4a6 100644 --- a/src/resolve/resolved-dns-packet.c +++ b/src/resolve/resolved-dns-packet.c @@ -388,14 +388,21 @@ int dns_packet_append_label(DnsPacket *p, const char *d, size_t l, size_t *start return 0; } -int dns_packet_append_name(DnsPacket *p, const char *name, - bool allow_compression, size_t *start) { +int dns_packet_append_name( + DnsPacket *p, + const char *name, + bool allow_compression, + size_t *start) { + size_t saved_size; int r; assert(p); assert(name); + if (p->refuse_compression) + allow_compression = false; + saved_size = p->size; while (*name) { @@ -1053,8 +1060,12 @@ fail: return r; } -int dns_packet_read_name(DnsPacket *p, char **_ret, - bool allow_compression, size_t *start) { +int dns_packet_read_name( + DnsPacket *p, + char **_ret, + bool allow_compression, + size_t *start) { + size_t saved_rindex, after_rindex = 0, jump_barrier; _cleanup_free_ char *ret = NULL; size_t n = 0, allocated = 0; @@ -1064,6 +1075,9 @@ int dns_packet_read_name(DnsPacket *p, char **_ret, assert(p); assert(_ret); + if (p->refuse_compression) + allow_compression = false; + saved_rindex = p->rindex; jump_barrier = p->rindex; |