summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-01-30 18:00:46 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-01-30 18:00:46 +0000
commit66232b481862c2ad5fc66ec35b6be68c7bf4d277 (patch)
treed09cd4c742eaf1e848433787beaeae07e98ffaa4 /src
parent088cb558ceb375943ffa995d0c541ad43b309b9d (diff)
downloads6-dns-66232b481862c2ad5fc66ec35b6be68c7bf4d277.tar.xz
Attempt to fix the PPC bug. FUCK REPRESENTATION OF CHARS WITH A CHAINSAW, SIDEWAYS.
Diffstat (limited to 'src')
-rw-r--r--src/libs6dns/s6dns_message_header_pack.c2
-rw-r--r--src/libs6dns/s6dns_message_header_unpack.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/libs6dns/s6dns_message_header_pack.c b/src/libs6dns/s6dns_message_header_pack.c
index 99ffa8a..ff496fa 100644
--- a/src/libs6dns/s6dns_message_header_pack.c
+++ b/src/libs6dns/s6dns_message_header_pack.c
@@ -6,7 +6,7 @@
void s6dns_message_header_pack (char *s, s6dns_message_header_t const *h)
{
uint16_pack_big(s, h->id) ;
- s[2] = (h->qr << 7) | (h->opcode << 3) | (h->aa << 2) | (h->tc << 1) | h->rd ;
+ s[2] = (char)(unsigned char)((h->qr << 7) | (h->opcode << 3) | (h->aa << 2) | (h->tc << 1) | h->rd) ;
s[3] = (h->z << 4) | h->rcode ;
s6dns_message_counts_pack(s+4, &h->counts) ;
}
diff --git a/src/libs6dns/s6dns_message_header_unpack.c b/src/libs6dns/s6dns_message_header_unpack.c
index ae2b35c..8b12ca9 100644
--- a/src/libs6dns/s6dns_message_header_unpack.c
+++ b/src/libs6dns/s6dns_message_header_unpack.c
@@ -6,7 +6,7 @@
void s6dns_message_header_unpack (char const *s, s6dns_message_header_t *h)
{
uint16_unpack_big(s, &h->id) ;
- h->qr = s[2] & 0x8000U ? 1 : 0 ;
+ h->qr = ((unsigned char *)s)[2] & 0x8000U ? 1 : 0 ;
h->opcode = (s[2] >> 3) & 15 ;
h->aa = s[2] & 4 ? 1 : 0 ;
h->tc = s[2] & 2 ? 1 : 0 ;