summaryrefslogtreecommitdiff
path: root/lib/dns/portlist.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dns/portlist.c')
-rw-r--r--lib/dns/portlist.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/dns/portlist.c b/lib/dns/portlist.c
index 5bc89f482984..754eef668792 100644
--- a/lib/dns/portlist.c
+++ b/lib/dns/portlist.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2007, 2014 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -80,7 +80,7 @@ dns_portlist_create(isc_mem_t *mctx, dns_portlist_t **portlistp) {
portlist = isc_mem_get(mctx, sizeof(*portlist));
if (portlist == NULL)
return (ISC_R_NOMEMORY);
- result = isc_mutex_init(&portlist->lock);
+ result = isc_mutex_init(&portlist->lock);
if (result != ISC_R_SUCCESS) {
isc_mem_put(mctx, portlist, sizeof(*portlist));
return (result);
@@ -111,7 +111,7 @@ find_port(dns_element_t *list, unsigned int len, in_port_t port) {
for (;;) {
if (list[xtry].port == port)
return (&list[xtry]);
- if (port > list[xtry].port) {
+ if (port > list[xtry].port) {
if (xtry == max)
break;
min = xtry;
@@ -164,8 +164,8 @@ dns_portlist_add(dns_portlist_t *portlist, int af, in_port_t port) {
goto unlock;
}
if (portlist->list != NULL) {
- memcpy(el, portlist->list,
- portlist->allocated * sizeof(*el));
+ memmove(el, portlist->list,
+ portlist->allocated * sizeof(*el));
isc_mem_put(portlist->mctx, portlist->list,
portlist->allocated * sizeof(*el));
}
@@ -215,7 +215,7 @@ isc_boolean_t
dns_portlist_match(dns_portlist_t *portlist, int af, in_port_t port) {
dns_element_t *el;
isc_boolean_t result = ISC_FALSE;
-
+
REQUIRE(DNS_VALID_PORTLIST(portlist));
REQUIRE(af == AF_INET || af == AF_INET6);
LOCK(&portlist->lock);
@@ -227,7 +227,7 @@ dns_portlist_match(dns_portlist_t *portlist, int af, in_port_t port) {
if (af == AF_INET6 && (el->flags & DNS_PL_INET6) != 0)
result = ISC_TRUE;
}
- }
+ }
UNLOCK(&portlist->lock);
return (result);
}