diff options
Diffstat (limited to 'lib/dns/tsig.c')
-rw-r--r-- | lib/dns/tsig.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/dns/tsig.c b/lib/dns/tsig.c index 307cb2577b41..05f98ad7bb27 100644 --- a/lib/dns/tsig.c +++ b/lib/dns/tsig.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -1133,9 +1133,6 @@ dns_tsig_sign(dns_message_t *msg) { goto cleanup_rdatalist; datalist->rdclass = dns_rdataclass_any; datalist->type = dns_rdatatype_tsig; - datalist->covers = 0; - datalist->ttl = 0; - ISC_LIST_INIT(datalist->rdata); ISC_LIST_APPEND(datalist->rdata, rdata, link); dns_rdataset_init(dataset); RUNTIME_CHECK(dns_rdatalist_tordataset(datalist, dataset) @@ -1343,6 +1340,8 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg, } if (tsig.siglen > 0) { + isc_uint16_t addcount_n; + sig_r.base = tsig.signature; sig_r.length = tsig.siglen; @@ -1378,7 +1377,8 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg, * Decrement the additional field counter. */ memmove(&addcount, &header[DNS_MESSAGE_HEADERLEN - 2], 2); - addcount = htons((isc_uint16_t)(ntohs(addcount) - 1)); + addcount_n = ntohs(addcount); + addcount = htons((isc_uint16_t)(addcount_n - 1)); memmove(&header[DNS_MESSAGE_HEADERLEN - 2], &addcount, 2); /* @@ -1617,8 +1617,11 @@ tsig_verify_tcp(isc_buffer_t *source, dns_message_t *msg) { * Decrement the additional field counter if necessary. */ if (has_tsig) { + isc_uint16_t addcount_n; + memmove(&addcount, &header[DNS_MESSAGE_HEADERLEN - 2], 2); - addcount = htons((isc_uint16_t)(ntohs(addcount) - 1)); + addcount_n = ntohs(addcount); + addcount = htons((isc_uint16_t)(addcount_n - 1)); memmove(&header[DNS_MESSAGE_HEADERLEN - 2], &addcount, 2); } |