summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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 ;