summaryrefslogtreecommitdiff
path: root/src/resolve/resolved-dns-packet.c
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2015-07-14 13:26:16 -0400
committerDaniel Mack <github@zonque.org>2015-07-14 13:26:16 -0400
commitc0d645b51f6a65a03cce4e29ed276ccdcb5b6ab0 (patch)
treefb5f6d2154cb7d2a021a57721f5f92962cd24361 /src/resolve/resolved-dns-packet.c
parentca970016b7e5176e94eee3af24a70d5b3355018f (diff)
parentd20b1667dbab8bccf69735523a0d5fc645e81b80 (diff)
Merge pull request #585 from teg/resolved-harden-2
resolved: harden
Diffstat (limited to 'src/resolve/resolved-dns-packet.c')
-rw-r--r--src/resolve/resolved-dns-packet.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/resolve/resolved-dns-packet.c b/src/resolve/resolved-dns-packet.c
index fa0516f8a0..a9cc5ca6aa 100644
--- a/src/resolve/resolved-dns-packet.c
+++ b/src/resolve/resolved-dns-packet.c
@@ -32,10 +32,10 @@ int dns_packet_new(DnsPacket **ret, DnsProtocol protocol, size_t mtu) {
assert(ret);
- if (mtu <= 0)
+ if (mtu <= UDP_PACKET_HEADER_SIZE)
a = DNS_PACKET_SIZE_START;
else
- a = mtu;
+ a = mtu - UDP_PACKET_HEADER_SIZE;
if (a < DNS_PACKET_HEADER_SIZE)
a = DNS_PACKET_HEADER_SIZE;