diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-01-30 18:10:11 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-01-30 18:10:11 +0000 |
commit | f417b72c9489cd7c20b94eb8904a8911b7f6fd15 (patch) | |
tree | 01b15d9d161599eb0dc4611f4a37b0bf7a7929f2 | |
parent | 66232b481862c2ad5fc66ec35b6be68c7bf4d277 (diff) | |
download | s6-dns-f417b72c9489cd7c20b94eb8904a8911b7f6fd15.tar.xz |
bugfix: DNS reply header was incorrectly decoded.
-rw-r--r-- | src/libs6dns/s6dns_message_header_unpack.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libs6dns/s6dns_message_header_unpack.c b/src/libs6dns/s6dns_message_header_unpack.c index 8b12ca9..819b953 100644 --- a/src/libs6dns/s6dns_message_header_unpack.c +++ b/src/libs6dns/s6dns_message_header_unpack.c @@ -6,12 +6,12 @@ void s6dns_message_header_unpack (char const *s, s6dns_message_header_t *h) { uint16_unpack_big(s, &h->id) ; - h->qr = ((unsigned char *)s)[2] & 0x8000U ? 1 : 0 ; + h->qr = ((unsigned char *)s)[2] & 0x80U ? 1 : 0 ; h->opcode = (s[2] >> 3) & 15 ; h->aa = s[2] & 4 ? 1 : 0 ; h->tc = s[2] & 2 ? 1 : 0 ; h->rd = s[2] & 1 ; - h->ra = s[3] & 0x8000U ? 1 : 0 ; + h->ra = s[3] & 0x80U ? 1 : 0 ; h->z = (s[3] >> 4) & 7 ; h->rcode = s[3] & 15 ; s6dns_message_counts_unpack(s+4, &h->counts) ; |