2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 21:47:59 +00:00

Fix -Wshadow warnings (#38762)

These happen due to ntohs()/htons() macro expansion in glibc.
This commit is contained in:
Mukund Sivaraman 2015-03-09 09:23:46 +05:30
parent 73eacba1f1
commit f5a62d97e3
2 changed files with 11 additions and 4 deletions

View File

@ -984,7 +984,7 @@ dns_dnssec_verifymessage(isc_buffer_t *source, dns_message_t *msg,
dst_context_t *ctx = NULL; dst_context_t *ctx = NULL;
isc_mem_t *mctx; isc_mem_t *mctx;
isc_result_t result; isc_result_t result;
isc_uint16_t addcount; isc_uint16_t addcount, addcount_n;
isc_boolean_t signeedsfree = ISC_FALSE; isc_boolean_t signeedsfree = ISC_FALSE;
REQUIRE(source != NULL); REQUIRE(source != NULL);
@ -1062,7 +1062,8 @@ dns_dnssec_verifymessage(isc_buffer_t *source, dns_message_t *msg,
* Decrement the additional field counter. * Decrement the additional field counter.
*/ */
memmove(&addcount, &header[DNS_MESSAGE_HEADERLEN - 2], 2); 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); memmove(&header[DNS_MESSAGE_HEADERLEN - 2], &addcount, 2);
/* /*

View File

@ -1341,6 +1341,8 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg,
} }
if (tsig.siglen > 0) { if (tsig.siglen > 0) {
isc_uint16_t addcount_n;
sig_r.base = tsig.signature; sig_r.base = tsig.signature;
sig_r.length = tsig.siglen; sig_r.length = tsig.siglen;
@ -1377,7 +1379,8 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg,
* Decrement the additional field counter. * Decrement the additional field counter.
*/ */
memmove(&addcount, &header[DNS_MESSAGE_HEADERLEN - 2], 2); 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); memmove(&header[DNS_MESSAGE_HEADERLEN - 2], &addcount, 2);
/* /*
@ -1616,8 +1619,11 @@ tsig_verify_tcp(isc_buffer_t *source, dns_message_t *msg) {
* Decrement the additional field counter if necessary. * Decrement the additional field counter if necessary.
*/ */
if (has_tsig) { if (has_tsig) {
isc_uint16_t addcount_n;
memmove(&addcount, &header[DNS_MESSAGE_HEADERLEN - 2], 2); 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); memmove(&header[DNS_MESSAGE_HEADERLEN - 2], &addcount, 2);
} }