2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 05:57:52 +00:00

[master] replace memcpy() with memmove().

3698.	[cleanup]	Replaced all uses of memcpy() with memmove().
			[RT #35120]
This commit is contained in:
Evan Hunt 2014-01-08 16:27:10 -08:00
parent bfb3305684
commit e851ea8260
126 changed files with 494 additions and 490 deletions

View File

@ -1,3 +1,6 @@
3698. [cleanup] Replaced all uses of memcpy() with memmove().
[RT #35120]
3697. [bug] Handle "." as a search list element when IDN support 3697. [bug] Handle "." as a search list element when IDN support
is enabled. [RT #35133] is enabled. [RT #35133]

View File

@ -101,7 +101,7 @@ main(int argc, char **argv) {
result = isc_file_progname(*argv, program, sizeof(program)); result = isc_file_progname(*argv, program, sizeof(program));
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
memcpy(program, "ddns-confgen", 13); memmove(program, "ddns-confgen", 13);
progname = program; progname = program;
isc_commandline_errprint = ISC_FALSE; isc_commandline_errprint = ISC_FALSE;

View File

@ -120,7 +120,7 @@ main(int argc, char **argv) {
result = isc_file_progname(*argv, program, sizeof(program)); result = isc_file_progname(*argv, program, sizeof(program));
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
memcpy(program, "rndc-confgen", 13); memmove(program, "rndc-confgen", 13);
progname = program; progname = program;
keyname = DEFAULT_KEYNAME; keyname = DEFAULT_KEYNAME;

View File

@ -448,7 +448,7 @@ static isc_result_t
append(const char *text, int len, char **p, char *end) { append(const char *text, int len, char **p, char *end) {
if (len > end - *p) if (len > end - *p)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(*p, text, len); memmove(*p, text, len);
*p += len; *p += len;
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
@ -3945,7 +3945,7 @@ output_filter(isc_buffer_t *buffer, unsigned int used_org,
fromlen = isc_buffer_usedlength(buffer) - used_org; fromlen = isc_buffer_usedlength(buffer) - used_org;
if (fromlen >= MAXDLEN) if (fromlen >= MAXDLEN)
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
memcpy(tmp1, (char *)isc_buffer_base(buffer) + used_org, fromlen); memmove(tmp1, (char *)isc_buffer_base(buffer) + used_org, fromlen);
end_with_dot = (tmp1[fromlen - 1] == '.') ? ISC_TRUE : ISC_FALSE; end_with_dot = (tmp1[fromlen - 1] == '.') ? ISC_TRUE : ISC_FALSE;
if (absolute && !end_with_dot) { if (absolute && !end_with_dot) {
fromlen++; fromlen++;
@ -3974,7 +3974,7 @@ output_filter(isc_buffer_t *buffer, unsigned int used_org,
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
isc_buffer_subtract(buffer, isc_buffer_usedlength(buffer) - used_org); isc_buffer_subtract(buffer, isc_buffer_usedlength(buffer) - used_org);
memcpy(isc_buffer_used(buffer), tmp1, tolen); memmove(isc_buffer_used(buffer), tmp1, tolen);
isc_buffer_add(buffer, (unsigned int)tolen); isc_buffer_add(buffer, (unsigned int)tolen);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);

View File

@ -729,7 +729,7 @@ hashlist_add(hashlist_t *l, const unsigned char *hash, size_t len)
fatal("unable to grow hashlist: out of memory"); fatal("unable to grow hashlist: out of memory");
} }
memset(l->hashbuf + l->entries * l->length, 0, l->length); memset(l->hashbuf + l->entries * l->length, 0, l->length);
memcpy(l->hashbuf + l->entries * l->length, hash, len); memmove(l->hashbuf + l->entries * l->length, hash, len);
l->entries++; l->entries++;
} }
@ -2666,7 +2666,7 @@ set_nsec3params(isc_boolean_t update_chain, isc_boolean_t set_salt,
"Use -u to update it."); "Use -u to update it.");
} else if (!set_salt) { } else if (!set_salt) {
salt_length = orig_saltlen; salt_length = orig_saltlen;
memcpy(saltbuf, orig_salt, orig_saltlen); memmove(saltbuf, orig_salt, orig_saltlen);
salt = saltbuf; salt = saltbuf;
} }

View File

@ -725,11 +725,11 @@ record_nsec3(const unsigned char *rawhash, const dns_rdata_nsec3_t *nsec3,
element->next_length = nsec3->next_length; element->next_length = nsec3->next_length;
element->iterations = nsec3->iterations; element->iterations = nsec3->iterations;
cp = (unsigned char *)(element + 1); cp = (unsigned char *)(element + 1);
memcpy(cp, nsec3->salt, nsec3->salt_length); memmove(cp, nsec3->salt, nsec3->salt_length);
cp += nsec3->salt_length; cp += nsec3->salt_length;
memcpy(cp, rawhash, nsec3->next_length); memmove(cp, rawhash, nsec3->next_length);
cp += nsec3->next_length; cp += nsec3->next_length;
memcpy(cp, nsec3->next, nsec3->next_length); memmove(cp, nsec3->next, nsec3->next_length);
result = isc_heap_insert(chains, element); result = isc_heap_insert(chains, element);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
fprintf(stderr, "isc_heap_insert failed: %s\n", fprintf(stderr, "isc_heap_insert failed: %s\n",

View File

@ -117,7 +117,7 @@ dns64_rdata(unsigned char *v, size_t start, unsigned char *rdata) {
rdata[j++] = decimal[c]; rdata[j++] = decimal[c];
} }
} }
memcpy(&rdata[j], "\07in-addr\04arpa", 14); memmove(&rdata[j], "\07in-addr\04arpa", 14);
return (j + 14); return (j + 14);
} }
@ -320,7 +320,7 @@ put_txt(dns_sdblookup_t *lookup, const char *text) {
if (len > 255) if (len > 255)
len = 255; /* Silently truncate */ len = 255; /* Silently truncate */
buf[0] = len; buf[0] = len;
memcpy(&buf[1], text, len); memmove(&buf[1], text, len);
return (dns_sdb_putrdata(lookup, dns_rdatatype_txt, 0, buf, len + 1)); return (dns_sdb_putrdata(lookup, dns_rdatatype_txt, 0, buf, len + 1));
} }
@ -502,11 +502,11 @@ builtin_create(const char *zone, int argc, char **argv,
isc_mem_put(ns_g_mctx, empty, sizeof (*empty)); isc_mem_put(ns_g_mctx, empty, sizeof (*empty));
} else { } else {
if (strcmp(argv[0], "empty") == 0) if (strcmp(argv[0], "empty") == 0)
memcpy(empty, &empty_builtin, memmove(empty, &empty_builtin,
sizeof (empty_builtin)); sizeof (empty_builtin));
else else
memcpy(empty, &dns64_builtin, memmove(empty, &dns64_builtin,
sizeof (empty_builtin)); sizeof (empty_builtin));
empty->server = server; empty->server = server;
empty->contact = contact; empty->contact = contact;
*dbdata = empty; *dbdata = empty;

View File

@ -634,7 +634,7 @@ ns_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
if (new == NULL) if (new == NULL)
goto cleanup; goto cleanup;
if (listcount != 0) { if (listcount != 0) {
memcpy(new, lists, oldsize); memmove(new, lists, oldsize);
isc_mem_put(mctx, lists, oldsize); isc_mem_put(mctx, lists, oldsize);
} }
lists = new; lists = new;
@ -669,7 +669,7 @@ ns_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
if (new == NULL) if (new == NULL)
goto cleanup; goto cleanup;
if (stackcount != 0) { if (stackcount != 0) {
memcpy(new, stack, oldsize); memmove(new, stack, oldsize);
isc_mem_put(mctx, stack, oldsize); isc_mem_put(mctx, stack, oldsize);
} }
stack = new; stack = new;
@ -697,7 +697,7 @@ ns_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
if (new == NULL) if (new == NULL)
goto cleanup; goto cleanup;
if (addrcount != 0) { if (addrcount != 0) {
memcpy(new, addrs, oldsize); memmove(new, addrs, oldsize);
isc_mem_put(mctx, addrs, oldsize); isc_mem_put(mctx, addrs, oldsize);
} }
addrs = new; addrs = new;
@ -709,7 +709,7 @@ ns_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
if (new == NULL) if (new == NULL)
goto cleanup; goto cleanup;
if (dscpcount != 0) { if (dscpcount != 0) {
memcpy(new, dscps, oldsize); memmove(new, dscps, oldsize);
isc_mem_put(mctx, dscps, oldsize); isc_mem_put(mctx, dscps, oldsize);
} }
dscps = new; dscps = new;
@ -721,7 +721,7 @@ ns_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
if (new == NULL) if (new == NULL)
goto cleanup; goto cleanup;
if (keycount != 0) { if (keycount != 0) {
memcpy(new, keys, oldsize); memmove(new, keys, oldsize);
isc_mem_put(mctx, keys, oldsize); isc_mem_put(mctx, keys, oldsize);
} }
keys = new; keys = new;
@ -773,7 +773,7 @@ ns_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
new = isc_mem_get(mctx, newsize); new = isc_mem_get(mctx, newsize);
if (new == NULL) if (new == NULL)
goto cleanup; goto cleanup;
memcpy(new, addrs, newsize); memmove(new, addrs, newsize);
} else } else
new = NULL; new = NULL;
isc_mem_put(mctx, addrs, oldsize); isc_mem_put(mctx, addrs, oldsize);
@ -786,7 +786,7 @@ ns_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
new = isc_mem_get(mctx, newsize); new = isc_mem_get(mctx, newsize);
if (new == NULL) if (new == NULL)
goto cleanup; goto cleanup;
memcpy(new, dscps, newsize); memmove(new, dscps, newsize);
} else } else
new = NULL; new = NULL;
isc_mem_put(mctx, dscps, oldsize); isc_mem_put(mctx, dscps, oldsize);
@ -799,7 +799,7 @@ ns_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
new = isc_mem_get(mctx, newsize); new = isc_mem_get(mctx, newsize);
if (new == NULL) if (new == NULL)
goto cleanup; goto cleanup;
memcpy(new, keys, newsize); memmove(new, keys, newsize);
} else } else
new = NULL; new = NULL;
isc_mem_put(mctx, keys, oldsize); isc_mem_put(mctx, keys, oldsize);

View File

@ -370,7 +370,7 @@ control_recvmessage(isc_task_t *task, isc_event_t *event) {
secret.rstart = isc_mem_get(listener->mctx, key->secret.length); secret.rstart = isc_mem_get(listener->mctx, key->secret.length);
if (secret.rstart == NULL) if (secret.rstart == NULL)
goto cleanup; goto cleanup;
memcpy(secret.rstart, key->secret.base, key->secret.length); memmove(secret.rstart, key->secret.base, key->secret.length);
secret.rend = secret.rstart + key->secret.length; secret.rend = secret.rstart + key->secret.length;
algorithm = key->algorithm; algorithm = key->algorithm;
result = isccc_cc_fromwire(&ccregion, &request, result = isccc_cc_fromwire(&ccregion, &request,
@ -795,8 +795,8 @@ register_keys(const cfg_obj_t *control, const cfg_obj_t *keylist,
free_controlkey(keyid, mctx); free_controlkey(keyid, mctx);
break; break;
} }
memcpy(keyid->secret.base, isc_buffer_base(&b), memmove(keyid->secret.base, isc_buffer_base(&b),
keyid->secret.length); keyid->secret.length);
} }
} }
} }
@ -879,8 +879,8 @@ get_rndckey(isc_mem_t *mctx, controlkeylist_t *keyids) {
"out of memory", keyid->keyname); "out of memory", keyid->keyname);
CHECK(ISC_R_NOMEMORY); CHECK(ISC_R_NOMEMORY);
} }
memcpy(keyid->secret.base, isc_buffer_base(&b), memmove(keyid->secret.base, isc_buffer_base(&b),
keyid->secret.length); keyid->secret.length);
ISC_LIST_APPEND(*keyids, keyid, link); ISC_LIST_APPEND(*keyids, keyid, link);
keyid = NULL; keyid = NULL;
result = ISC_R_SUCCESS; result = ISC_R_SUCCESS;

View File

@ -41,11 +41,11 @@ lwaddr_netaddr_fromlwresaddr(isc_netaddr_t *na, lwres_addr_t *la) {
if (la->family == LWRES_ADDRTYPE_V4) { if (la->family == LWRES_ADDRTYPE_V4) {
struct in_addr ina; struct in_addr ina;
memcpy(&ina.s_addr, la->address, 4); memmove(&ina.s_addr, la->address, 4);
isc_netaddr_fromin(na, &ina); isc_netaddr_fromin(na, &ina);
} else { } else {
struct in6_addr ina6; struct in6_addr ina6;
memcpy(&ina6.s6_addr, la->address, 16); memmove(&ina6.s6_addr, la->address, 16);
isc_netaddr_fromin6(na, &ina6); isc_netaddr_fromin6(na, &ina6);
} }
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
@ -77,11 +77,11 @@ lwaddr_lwresaddr_fromnetaddr(lwres_addr_t *la, isc_netaddr_t *na) {
if (na->family == AF_INET) { if (na->family == AF_INET) {
la->family = LWRES_ADDRTYPE_V4; la->family = LWRES_ADDRTYPE_V4;
la->length = 4; la->length = 4;
memcpy(la->address, &na->type.in, 4); memmove(la->address, &na->type.in, 4);
} else { } else {
la->family = LWRES_ADDRTYPE_V6; la->family = LWRES_ADDRTYPE_V6;
la->length = 16; la->length = 16;
memcpy(la->address, &na->type.in6, 16); memmove(la->address, &na->type.in6, 16);
} }
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }

View File

@ -226,12 +226,12 @@ ns_lwdclient_processgnba(ns_lwdclient_t *client, lwres_buffer_t *b) {
client->na.family = AF_INET; client->na.family = AF_INET;
if (req->addr.length != 4) if (req->addr.length != 4)
goto out; goto out;
memcpy(&client->na.type.in, req->addr.address, 4); memmove(&client->na.type.in, req->addr.address, 4);
} else if (req->addr.family == LWRES_ADDRTYPE_V6) { } else if (req->addr.family == LWRES_ADDRTYPE_V6) {
client->na.family = AF_INET6; client->na.family = AF_INET6;
if (req->addr.length != 16) if (req->addr.length != 16)
goto out; goto out;
memcpy(&client->na.type.in6, req->addr.address, 16); memmove(&client->na.type.in6, req->addr.address, 16);
} else { } else {
goto out; goto out;
} }

View File

@ -124,8 +124,8 @@ iterate_node(lwres_grbnresponse_t *grbn, dns_db_t *db, dns_dbnode_t *node,
lens = isc_mem_get(mctx, size * sizeof(*lens)); lens = isc_mem_get(mctx, size * sizeof(*lens));
if (lens == NULL) if (lens == NULL)
goto out; goto out;
memcpy(rdatas, oldrdatas, used * sizeof(*rdatas)); memmove(rdatas, oldrdatas, used * sizeof(*rdatas));
memcpy(lens, oldlens, used * sizeof(*lens)); memmove(lens, oldlens, used * sizeof(*lens));
isc_mem_put(mctx, oldrdatas, isc_mem_put(mctx, oldrdatas,
oldsize * sizeof(*oldrdatas)); oldsize * sizeof(*oldrdatas));
isc_mem_put(mctx, oldlens, oldsize * sizeof(*oldlens)); isc_mem_put(mctx, oldlens, oldsize * sizeof(*oldlens));
@ -158,8 +158,8 @@ iterate_node(lwres_grbnresponse_t *grbn, dns_db_t *db, dns_dbnode_t *node,
newlens = isc_mem_get(mctx, used * sizeof(*lens)); newlens = isc_mem_get(mctx, used * sizeof(*lens));
if (newlens == NULL) if (newlens == NULL)
goto out; goto out;
memcpy(newrdatas, rdatas, used * sizeof(*rdatas)); memmove(newrdatas, rdatas, used * sizeof(*rdatas));
memcpy(newlens, lens, used * sizeof(*lens)); memmove(newlens, lens, used * sizeof(*lens));
isc_mem_put(mctx, rdatas, size * sizeof(*rdatas)); isc_mem_put(mctx, rdatas, size * sizeof(*rdatas));
isc_mem_put(mctx, lens, size * sizeof(*lens)); isc_mem_put(mctx, lens, size * sizeof(*lens));
grbn->rdatas = newrdatas; grbn->rdatas = newrdatas;

View File

@ -4606,12 +4606,12 @@ rpz_rewrite_ip_rrset(ns_client_t *client,
switch (rdata.type) { switch (rdata.type) {
case dns_rdatatype_a: case dns_rdatatype_a:
INSIST(rdata.length == 4); INSIST(rdata.length == 4);
memcpy(&ina.s_addr, rdata.data, 4); memmove(&ina.s_addr, rdata.data, 4);
isc_netaddr_fromin(&netaddr, &ina); isc_netaddr_fromin(&netaddr, &ina);
break; break;
case dns_rdatatype_aaaa: case dns_rdatatype_aaaa:
INSIST(rdata.length == 16); INSIST(rdata.length == 16);
memcpy(in6a.s6_addr, rdata.data, 16); memmove(in6a.s6_addr, rdata.data, 16);
isc_netaddr_fromin6(&netaddr, &in6a); isc_netaddr_fromin6(&netaddr, &in6a);
break; break;
default: default:
@ -5381,12 +5381,12 @@ rdata_tonetaddr(const dns_rdata_t *rdata, isc_netaddr_t *netaddr) {
switch (rdata->type) { switch (rdata->type) {
case dns_rdatatype_a: case dns_rdatatype_a:
INSIST(rdata->length == 4); INSIST(rdata->length == 4);
memcpy(&ina.s_addr, rdata->data, 4); memmove(&ina.s_addr, rdata->data, 4);
isc_netaddr_fromin(netaddr, &ina); isc_netaddr_fromin(netaddr, &ina);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
case dns_rdatatype_aaaa: case dns_rdatatype_aaaa:
INSIST(rdata->length == 16); INSIST(rdata->length == 16);
memcpy(in6a.s6_addr, rdata->data, 16); memmove(in6a.s6_addr, rdata->data, 16);
isc_netaddr_fromin6(netaddr, &in6a); isc_netaddr_fromin6(netaddr, &in6a);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
default: default:

View File

@ -9124,7 +9124,7 @@ ns_server_signing(ns_server_t *server, char *args, isc_buffer_t *text) {
ptr = next_token(&args, " \t"); ptr = next_token(&args, " \t");
if (ptr == NULL) if (ptr == NULL)
return (ISC_R_UNEXPECTEDEND); return (ISC_R_UNEXPECTEDEND);
memcpy(keystr, ptr, sizeof(keystr)); memmove(keystr, ptr, sizeof(keystr));
} else if (strcasecmp(ptr, "-nsec3param") == 0) { } else if (strcasecmp(ptr, "-nsec3param") == 0) {
const char *hashstr, *flagstr, *iterstr; const char *hashstr, *flagstr, *iterstr;
char nbuf[512]; char nbuf[512];

View File

@ -462,7 +462,7 @@ configure_staticstub_serveraddrs(const cfg_obj_t *zconfig, dns_zone_t *zone,
if (rdata == NULL) if (rdata == NULL)
return (ISC_R_NOMEMORY); return (ISC_R_NOMEMORY);
region.base = (unsigned char *)(rdata + 1); region.base = (unsigned char *)(rdata + 1);
memcpy(region.base, &na.type, region.length); memmove(region.base, &na.type, region.length);
dns_rdata_init(rdata); dns_rdata_init(rdata);
dns_rdata_fromregion(rdata, dns_zone_getclass(zone), dns_rdata_fromregion(rdata, dns_zone_getclass(zone),
rdatalist->type, &region); rdatalist->type, &region);
@ -490,7 +490,7 @@ configure_staticstub_serveraddrs(const cfg_obj_t *zconfig, dns_zone_t *zone,
} }
region.length = sregion.length; region.length = sregion.length;
region.base = (unsigned char *)(rdata + 1); region.base = (unsigned char *)(rdata + 1);
memcpy(region.base, sregion.base, region.length); memmove(region.base, sregion.base, region.length);
dns_rdata_init(rdata); dns_rdata_init(rdata);
dns_rdata_fromregion(rdata, dns_zone_getclass(zone), dns_rdata_fromregion(rdata, dns_zone_getclass(zone),
dns_rdatatype_ns, &region); dns_rdatatype_ns, &region);
@ -554,7 +554,7 @@ configure_staticstub_servernames(const cfg_obj_t *zconfig, dns_zone_t *zone,
return (ISC_R_NOMEMORY); return (ISC_R_NOMEMORY);
region.length = sregion.length; region.length = sregion.length;
region.base = (unsigned char *)(rdata + 1); region.base = (unsigned char *)(rdata + 1);
memcpy(region.base, sregion.base, region.length); memmove(region.base, sregion.base, region.length);
dns_rdata_init(rdata); dns_rdata_init(rdata);
dns_rdata_fromregion(rdata, dns_zone_getclass(zone), dns_rdata_fromregion(rdata, dns_zone_getclass(zone),
dns_rdatatype_ns, &region); dns_rdatatype_ns, &region);

View File

@ -840,13 +840,16 @@ setup_system(void) {
if (servers == NULL) if (servers == NULL)
fatal("out of memory"); fatal("out of memory");
for (i = 0; i < ns_total; i++) { for (i = 0; i < ns_total; i++) {
if (lwconf->nameservers[i].family == LWRES_ADDRTYPE_V4) { if (lwconf->nameservers[i].family == LWRES_ADDRTYPE_V4)
{
struct in_addr in4; struct in_addr in4;
memcpy(&in4, lwconf->nameservers[i].address, 4); memmove(&in4,
lwconf->nameservers[i].address, 4);
isc_sockaddr_fromin(&servers[i], &in4, dnsport); isc_sockaddr_fromin(&servers[i], &in4, dnsport);
} else { } else {
struct in6_addr in6; struct in6_addr in6;
memcpy(&in6, lwconf->nameservers[i].address, 16); memmove(&in6,
lwconf->nameservers[i].address, 16);
isc_sockaddr_fromin6(&servers[i], &in6, isc_sockaddr_fromin6(&servers[i], &in6,
dnsport); dnsport);
} }
@ -2607,7 +2610,7 @@ start_gssrequest(dns_name_t *master) {
if (userserver == NULL) if (userserver == NULL)
get_address(namestr, dnsport, kserver); get_address(namestr, dnsport, kserver);
else else
(void)memcpy(kserver, userserver, sizeof(isc_sockaddr_t)); (void)memmove(kserver, userserver, sizeof(isc_sockaddr_t));
dns_fixedname_init(&fname); dns_fixedname_init(&fname);
servname = dns_fixedname_name(&fname); servname = dns_fixedname_name(&fname);

View File

@ -745,7 +745,7 @@ main(int argc, char **argv) {
result = isc_file_progname(*argv, program, sizeof(program)); result = isc_file_progname(*argv, program, sizeof(program));
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
memcpy(program, "rndc", 5); memmove(program, "rndc", 5);
progname = program; progname = program;
admin_conffile = RNDC_CONFFILE; admin_conffile = RNDC_CONFFILE;
@ -877,7 +877,7 @@ main(int argc, char **argv) {
p = args; p = args;
for (i = 0; i < argc; i++) { for (i = 0; i < argc; i++) {
size_t len = strlen(argv[i]); size_t len = strlen(argv[i]);
memcpy(p, argv[i], len); memmove(p, argv[i], len);
p += len; p += len;
*p++ = ' '; *p++ = ' ';
} }

View File

@ -66,35 +66,35 @@ main(int argc, char **argv) {
s = "abc"; s = "abc";
isc_sha1_init(&sha1); isc_sha1_init(&sha1);
memcpy(buffer, s, strlen(s)); memmove(buffer, s, strlen(s));
isc_sha1_update(&sha1, buffer, strlen(s)); isc_sha1_update(&sha1, buffer, strlen(s));
isc_sha1_final(&sha1, digest); isc_sha1_final(&sha1, digest);
print_digest(s, "sha1", digest, ISC_SHA1_DIGESTLENGTH/4); print_digest(s, "sha1", digest, ISC_SHA1_DIGESTLENGTH/4);
s = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"; s = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
isc_sha1_init(&sha1); isc_sha1_init(&sha1);
memcpy(buffer, s, strlen(s)); memmove(buffer, s, strlen(s));
isc_sha1_update(&sha1, buffer, strlen(s)); isc_sha1_update(&sha1, buffer, strlen(s));
isc_sha1_final(&sha1, digest); isc_sha1_final(&sha1, digest);
print_digest(s, "sha1", digest, ISC_SHA1_DIGESTLENGTH/4); print_digest(s, "sha1", digest, ISC_SHA1_DIGESTLENGTH/4);
s = "abc"; s = "abc";
isc_sha224_init(&sha224); isc_sha224_init(&sha224);
memcpy(buffer, s, strlen(s)); memmove(buffer, s, strlen(s));
isc_sha224_update(&sha224, buffer, strlen(s)); isc_sha224_update(&sha224, buffer, strlen(s));
isc_sha224_final(digest, &sha224); isc_sha224_final(digest, &sha224);
print_digest(s, "sha224", digest, ISC_SHA224_DIGESTLENGTH/4); print_digest(s, "sha224", digest, ISC_SHA224_DIGESTLENGTH/4);
s = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"; s = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
isc_sha224_init(&sha224); isc_sha224_init(&sha224);
memcpy(buffer, s, strlen(s)); memmove(buffer, s, strlen(s));
isc_sha224_update(&sha224, buffer, strlen(s)); isc_sha224_update(&sha224, buffer, strlen(s));
isc_sha224_final(digest, &sha224); isc_sha224_final(digest, &sha224);
print_digest(s, "sha224", digest, ISC_SHA224_DIGESTLENGTH/4); print_digest(s, "sha224", digest, ISC_SHA224_DIGESTLENGTH/4);
s = "abc"; s = "abc";
isc_md5_init(&md5); isc_md5_init(&md5);
memcpy(buffer, s, strlen(s)); memmove(buffer, s, strlen(s));
isc_md5_update(&md5, buffer, strlen(s)); isc_md5_update(&md5, buffer, strlen(s));
isc_md5_final(&md5, digest); isc_md5_final(&md5, digest);
print_digest(s, "md5", digest, 4); print_digest(s, "md5", digest, 4);
@ -105,7 +105,7 @@ main(int argc, char **argv) {
s = "Hi There"; s = "Hi There";
memset(key, 0x0b, 16); memset(key, 0x0b, 16);
isc_hmacmd5_init(&hmacmd5, key, 16); isc_hmacmd5_init(&hmacmd5, key, 16);
memcpy(buffer, s, strlen(s)); memmove(buffer, s, strlen(s));
isc_hmacmd5_update(&hmacmd5, buffer, strlen(s)); isc_hmacmd5_update(&hmacmd5, buffer, strlen(s));
isc_hmacmd5_sign(&hmacmd5, digest); isc_hmacmd5_sign(&hmacmd5, digest);
print_digest(s, "hmacmd5", digest, 4); print_digest(s, "hmacmd5", digest, 4);
@ -113,7 +113,7 @@ main(int argc, char **argv) {
s = "what do ya want for nothing?"; s = "what do ya want for nothing?";
strcpy((char *)key, "Jefe"); strcpy((char *)key, "Jefe");
isc_hmacmd5_init(&hmacmd5, key, 4); isc_hmacmd5_init(&hmacmd5, key, 4);
memcpy(buffer, s, strlen(s)); memmove(buffer, s, strlen(s));
isc_hmacmd5_update(&hmacmd5, buffer, strlen(s)); isc_hmacmd5_update(&hmacmd5, buffer, strlen(s));
isc_hmacmd5_sign(&hmacmd5, digest); isc_hmacmd5_sign(&hmacmd5, digest);
print_digest(s, "hmacmd5", digest, 4); print_digest(s, "hmacmd5", digest, 4);
@ -125,7 +125,7 @@ main(int argc, char **argv) {
"\335\335\335\335\335\335\335\335\335\335"; "\335\335\335\335\335\335\335\335\335\335";
memset(key, 0xaa, 16); memset(key, 0xaa, 16);
isc_hmacmd5_init(&hmacmd5, key, 16); isc_hmacmd5_init(&hmacmd5, key, 16);
memcpy(buffer, s, strlen(s)); memmove(buffer, s, strlen(s));
isc_hmacmd5_update(&hmacmd5, buffer, strlen(s)); isc_hmacmd5_update(&hmacmd5, buffer, strlen(s));
isc_hmacmd5_sign(&hmacmd5, digest); isc_hmacmd5_sign(&hmacmd5, digest);
print_digest(s, "hmacmd5", digest, 4); print_digest(s, "hmacmd5", digest, 4);
@ -136,7 +136,7 @@ main(int argc, char **argv) {
s = "Hi There"; s = "Hi There";
memset(key, 0x0b, 20); memset(key, 0x0b, 20);
isc_hmacsha1_init(&hmacsha1, key, 20); isc_hmacsha1_init(&hmacsha1, key, 20);
memcpy(buffer, s, strlen(s)); memmove(buffer, s, strlen(s));
isc_hmacsha1_update(&hmacsha1, buffer, strlen(s)); isc_hmacsha1_update(&hmacsha1, buffer, strlen(s));
isc_hmacsha1_sign(&hmacsha1, digest, ISC_SHA1_DIGESTLENGTH); isc_hmacsha1_sign(&hmacsha1, digest, ISC_SHA1_DIGESTLENGTH);
print_digest(s, "hmacsha1", digest, ISC_SHA1_DIGESTLENGTH/4); print_digest(s, "hmacsha1", digest, ISC_SHA1_DIGESTLENGTH/4);
@ -144,7 +144,7 @@ main(int argc, char **argv) {
s = "what do ya want for nothing?"; s = "what do ya want for nothing?";
strcpy((char *)key, "Jefe"); strcpy((char *)key, "Jefe");
isc_hmacsha1_init(&hmacsha1, key, 4); isc_hmacsha1_init(&hmacsha1, key, 4);
memcpy(buffer, s, strlen(s)); memmove(buffer, s, strlen(s));
isc_hmacsha1_update(&hmacsha1, buffer, strlen(s)); isc_hmacsha1_update(&hmacsha1, buffer, strlen(s));
isc_hmacsha1_sign(&hmacsha1, digest, ISC_SHA1_DIGESTLENGTH); isc_hmacsha1_sign(&hmacsha1, digest, ISC_SHA1_DIGESTLENGTH);
print_digest(s, "hmacsha1", digest, ISC_SHA1_DIGESTLENGTH/4); print_digest(s, "hmacsha1", digest, ISC_SHA1_DIGESTLENGTH/4);
@ -156,7 +156,7 @@ main(int argc, char **argv) {
"\335\335\335\335\335\335\335\335\335\335"; "\335\335\335\335\335\335\335\335\335\335";
memset(key, 0xaa, 20); memset(key, 0xaa, 20);
isc_hmacsha1_init(&hmacsha1, key, 20); isc_hmacsha1_init(&hmacsha1, key, 20);
memcpy(buffer, s, strlen(s)); memmove(buffer, s, strlen(s));
isc_hmacsha1_update(&hmacsha1, buffer, strlen(s)); isc_hmacsha1_update(&hmacsha1, buffer, strlen(s));
isc_hmacsha1_sign(&hmacsha1, digest, ISC_SHA1_DIGESTLENGTH); isc_hmacsha1_sign(&hmacsha1, digest, ISC_SHA1_DIGESTLENGTH);
print_digest(s, "hmacsha1", digest, ISC_SHA1_DIGESTLENGTH/4); print_digest(s, "hmacsha1", digest, ISC_SHA1_DIGESTLENGTH/4);
@ -167,7 +167,7 @@ main(int argc, char **argv) {
s = "Hi There"; s = "Hi There";
memset(key, 0x0b, 20); memset(key, 0x0b, 20);
isc_hmacsha224_init(&hmacsha224, key, 20); isc_hmacsha224_init(&hmacsha224, key, 20);
memcpy(buffer, s, strlen(s)); memmove(buffer, s, strlen(s));
isc_hmacsha224_update(&hmacsha224, buffer, strlen(s)); isc_hmacsha224_update(&hmacsha224, buffer, strlen(s));
isc_hmacsha224_sign(&hmacsha224, digest, ISC_SHA224_DIGESTLENGTH); isc_hmacsha224_sign(&hmacsha224, digest, ISC_SHA224_DIGESTLENGTH);
print_digest(s, "hmacsha224", digest, ISC_SHA224_DIGESTLENGTH/4); print_digest(s, "hmacsha224", digest, ISC_SHA224_DIGESTLENGTH/4);
@ -175,7 +175,7 @@ main(int argc, char **argv) {
s = "what do ya want for nothing?"; s = "what do ya want for nothing?";
strcpy((char *)key, "Jefe"); strcpy((char *)key, "Jefe");
isc_hmacsha224_init(&hmacsha224, key, 4); isc_hmacsha224_init(&hmacsha224, key, 4);
memcpy(buffer, s, strlen(s)); memmove(buffer, s, strlen(s));
isc_hmacsha224_update(&hmacsha224, buffer, strlen(s)); isc_hmacsha224_update(&hmacsha224, buffer, strlen(s));
isc_hmacsha224_sign(&hmacsha224, digest, ISC_SHA224_DIGESTLENGTH); isc_hmacsha224_sign(&hmacsha224, digest, ISC_SHA224_DIGESTLENGTH);
print_digest(s, "hmacsha224", digest, ISC_SHA224_DIGESTLENGTH/4); print_digest(s, "hmacsha224", digest, ISC_SHA224_DIGESTLENGTH/4);
@ -187,7 +187,7 @@ main(int argc, char **argv) {
"\335\335\335\335\335\335\335\335\335\335"; "\335\335\335\335\335\335\335\335\335\335";
memset(key, 0xaa, 20); memset(key, 0xaa, 20);
isc_hmacsha224_init(&hmacsha224, key, 20); isc_hmacsha224_init(&hmacsha224, key, 20);
memcpy(buffer, s, strlen(s)); memmove(buffer, s, strlen(s));
isc_hmacsha224_update(&hmacsha224, buffer, strlen(s)); isc_hmacsha224_update(&hmacsha224, buffer, strlen(s));
isc_hmacsha224_sign(&hmacsha224, digest, ISC_SHA224_DIGESTLENGTH); isc_hmacsha224_sign(&hmacsha224, digest, ISC_SHA224_DIGESTLENGTH);
print_digest(s, "hmacsha224", digest, ISC_SHA224_DIGESTLENGTH/4); print_digest(s, "hmacsha224", digest, ISC_SHA224_DIGESTLENGTH/4);
@ -198,7 +198,7 @@ main(int argc, char **argv) {
s = "Hi There"; s = "Hi There";
memset(key, 0x0b, 20); memset(key, 0x0b, 20);
isc_hmacsha256_init(&hmacsha256, key, 20); isc_hmacsha256_init(&hmacsha256, key, 20);
memcpy(buffer, s, strlen(s)); memmove(buffer, s, strlen(s));
isc_hmacsha256_update(&hmacsha256, buffer, strlen(s)); isc_hmacsha256_update(&hmacsha256, buffer, strlen(s));
isc_hmacsha256_sign(&hmacsha256, digest, ISC_SHA256_DIGESTLENGTH); isc_hmacsha256_sign(&hmacsha256, digest, ISC_SHA256_DIGESTLENGTH);
print_digest(s, "hmacsha256", digest, ISC_SHA256_DIGESTLENGTH/4); print_digest(s, "hmacsha256", digest, ISC_SHA256_DIGESTLENGTH/4);
@ -206,7 +206,7 @@ main(int argc, char **argv) {
s = "what do ya want for nothing?"; s = "what do ya want for nothing?";
strcpy((char *)key, "Jefe"); strcpy((char *)key, "Jefe");
isc_hmacsha256_init(&hmacsha256, key, 4); isc_hmacsha256_init(&hmacsha256, key, 4);
memcpy(buffer, s, strlen(s)); memmove(buffer, s, strlen(s));
isc_hmacsha256_update(&hmacsha256, buffer, strlen(s)); isc_hmacsha256_update(&hmacsha256, buffer, strlen(s));
isc_hmacsha256_sign(&hmacsha256, digest, ISC_SHA256_DIGESTLENGTH); isc_hmacsha256_sign(&hmacsha256, digest, ISC_SHA256_DIGESTLENGTH);
print_digest(s, "hmacsha256", digest, ISC_SHA256_DIGESTLENGTH/4); print_digest(s, "hmacsha256", digest, ISC_SHA256_DIGESTLENGTH/4);
@ -218,7 +218,7 @@ main(int argc, char **argv) {
"\335\335\335\335\335\335\335\335\335\335"; "\335\335\335\335\335\335\335\335\335\335";
memset(key, 0xaa, 20); memset(key, 0xaa, 20);
isc_hmacsha256_init(&hmacsha256, key, 20); isc_hmacsha256_init(&hmacsha256, key, 20);
memcpy(buffer, s, strlen(s)); memmove(buffer, s, strlen(s));
isc_hmacsha256_update(&hmacsha256, buffer, strlen(s)); isc_hmacsha256_update(&hmacsha256, buffer, strlen(s));
isc_hmacsha256_sign(&hmacsha256, digest, ISC_SHA256_DIGESTLENGTH); isc_hmacsha256_sign(&hmacsha256, digest, ISC_SHA256_DIGESTLENGTH);
print_digest(s, "hmacsha256", digest, ISC_SHA256_DIGESTLENGTH/4); print_digest(s, "hmacsha256", digest, ISC_SHA256_DIGESTLENGTH/4);
@ -229,7 +229,7 @@ main(int argc, char **argv) {
s = "Hi There"; s = "Hi There";
memset(key, 0x0b, 20); memset(key, 0x0b, 20);
isc_hmacsha384_init(&hmacsha384, key, 20); isc_hmacsha384_init(&hmacsha384, key, 20);
memcpy(buffer, s, strlen(s)); memmove(buffer, s, strlen(s));
isc_hmacsha384_update(&hmacsha384, buffer, strlen(s)); isc_hmacsha384_update(&hmacsha384, buffer, strlen(s));
isc_hmacsha384_sign(&hmacsha384, digest, ISC_SHA384_DIGESTLENGTH); isc_hmacsha384_sign(&hmacsha384, digest, ISC_SHA384_DIGESTLENGTH);
print_digest(s, "hmacsha384", digest, ISC_SHA384_DIGESTLENGTH/4); print_digest(s, "hmacsha384", digest, ISC_SHA384_DIGESTLENGTH/4);
@ -237,7 +237,7 @@ main(int argc, char **argv) {
s = "what do ya want for nothing?"; s = "what do ya want for nothing?";
strcpy((char *)key, "Jefe"); strcpy((char *)key, "Jefe");
isc_hmacsha384_init(&hmacsha384, key, 4); isc_hmacsha384_init(&hmacsha384, key, 4);
memcpy(buffer, s, strlen(s)); memmove(buffer, s, strlen(s));
isc_hmacsha384_update(&hmacsha384, buffer, strlen(s)); isc_hmacsha384_update(&hmacsha384, buffer, strlen(s));
isc_hmacsha384_sign(&hmacsha384, digest, ISC_SHA384_DIGESTLENGTH); isc_hmacsha384_sign(&hmacsha384, digest, ISC_SHA384_DIGESTLENGTH);
print_digest(s, "hmacsha384", digest, ISC_SHA384_DIGESTLENGTH/4); print_digest(s, "hmacsha384", digest, ISC_SHA384_DIGESTLENGTH/4);
@ -249,7 +249,7 @@ main(int argc, char **argv) {
"\335\335\335\335\335\335\335\335\335\335"; "\335\335\335\335\335\335\335\335\335\335";
memset(key, 0xaa, 20); memset(key, 0xaa, 20);
isc_hmacsha384_init(&hmacsha384, key, 20); isc_hmacsha384_init(&hmacsha384, key, 20);
memcpy(buffer, s, strlen(s)); memmove(buffer, s, strlen(s));
isc_hmacsha384_update(&hmacsha384, buffer, strlen(s)); isc_hmacsha384_update(&hmacsha384, buffer, strlen(s));
isc_hmacsha384_sign(&hmacsha384, digest, ISC_SHA384_DIGESTLENGTH); isc_hmacsha384_sign(&hmacsha384, digest, ISC_SHA384_DIGESTLENGTH);
print_digest(s, "hmacsha384", digest, ISC_SHA384_DIGESTLENGTH/4); print_digest(s, "hmacsha384", digest, ISC_SHA384_DIGESTLENGTH/4);
@ -260,7 +260,7 @@ main(int argc, char **argv) {
s = "Hi There"; s = "Hi There";
memset(key, 0x0b, 20); memset(key, 0x0b, 20);
isc_hmacsha512_init(&hmacsha512, key, 20); isc_hmacsha512_init(&hmacsha512, key, 20);
memcpy(buffer, s, strlen(s)); memmove(buffer, s, strlen(s));
isc_hmacsha512_update(&hmacsha512, buffer, strlen(s)); isc_hmacsha512_update(&hmacsha512, buffer, strlen(s));
isc_hmacsha512_sign(&hmacsha512, digest, ISC_SHA512_DIGESTLENGTH); isc_hmacsha512_sign(&hmacsha512, digest, ISC_SHA512_DIGESTLENGTH);
print_digest(s, "hmacsha512", digest, ISC_SHA512_DIGESTLENGTH/4); print_digest(s, "hmacsha512", digest, ISC_SHA512_DIGESTLENGTH/4);
@ -268,7 +268,7 @@ main(int argc, char **argv) {
s = "what do ya want for nothing?"; s = "what do ya want for nothing?";
strcpy((char *)key, "Jefe"); strcpy((char *)key, "Jefe");
isc_hmacsha512_init(&hmacsha512, key, 4); isc_hmacsha512_init(&hmacsha512, key, 4);
memcpy(buffer, s, strlen(s)); memmove(buffer, s, strlen(s));
isc_hmacsha512_update(&hmacsha512, buffer, strlen(s)); isc_hmacsha512_update(&hmacsha512, buffer, strlen(s));
isc_hmacsha512_sign(&hmacsha512, digest, ISC_SHA512_DIGESTLENGTH); isc_hmacsha512_sign(&hmacsha512, digest, ISC_SHA512_DIGESTLENGTH);
print_digest(s, "hmacsha512", digest, ISC_SHA512_DIGESTLENGTH/4); print_digest(s, "hmacsha512", digest, ISC_SHA512_DIGESTLENGTH/4);
@ -280,7 +280,7 @@ main(int argc, char **argv) {
"\335\335\335\335\335\335\335\335\335\335"; "\335\335\335\335\335\335\335\335\335\335";
memset(key, 0xaa, 20); memset(key, 0xaa, 20);
isc_hmacsha512_init(&hmacsha512, key, 20); isc_hmacsha512_init(&hmacsha512, key, 20);
memcpy(buffer, s, strlen(s)); memmove(buffer, s, strlen(s));
isc_hmacsha512_update(&hmacsha512, buffer, strlen(s)); isc_hmacsha512_update(&hmacsha512, buffer, strlen(s));
isc_hmacsha512_sign(&hmacsha512, digest, ISC_SHA512_DIGESTLENGTH); isc_hmacsha512_sign(&hmacsha512, digest, ISC_SHA512_DIGESTLENGTH);
print_digest(s, "hmacsha512", digest, ISC_SHA512_DIGESTLENGTH/4); print_digest(s, "hmacsha512", digest, ISC_SHA512_DIGESTLENGTH/4);

View File

@ -296,7 +296,7 @@ hname_to_tname(char *src, char *target, size_t len) {
*/ */
if (srclen >= len) if (srclen >= len)
return (1); return (1);
memcpy(target, src, srclen + 1); memmove(target, src, srclen + 1);
return (0); return (0);
} }

View File

@ -1193,7 +1193,7 @@ main(int argc, char *argv[]) {
dns_rdata_init(&last); dns_rdata_init(&last);
region.base = malloc(region.length = rdata.length); region.base = malloc(region.length = rdata.length);
if (region.base) { if (region.base) {
memcpy(region.base, rdata.data, rdata.length); memmove(region.base, rdata.data, rdata.length);
dns_rdata_fromregion(&last, class, type, &region); dns_rdata_fromregion(&last, class, type, &region);
lasttype = type; lasttype = type;
first = 0; first = 0;

View File

@ -1262,7 +1262,7 @@ validate_masters(const cfg_obj_t *obj, const cfg_obj_t *config,
void *ptr; void *ptr;
DE_CONST(stack, ptr); DE_CONST(stack, ptr);
memcpy(new, stack, oldsize); memmove(new, stack, oldsize);
isc_mem_put(mctx, ptr, oldsize); isc_mem_put(mctx, ptr, oldsize);
} }
stack = new; stack = new;

View File

@ -292,8 +292,8 @@ dns_acl_merge(dns_acl_t *dest, dns_acl_t *source, isc_boolean_t pos)
return (ISC_R_NOMEMORY); return (ISC_R_NOMEMORY);
/* Copy in the original elements */ /* Copy in the original elements */
memcpy(newmem, dest->elements, memmove(newmem, dest->elements,
dest->length * sizeof(dns_aclelement_t)); dest->length * sizeof(dns_aclelement_t));
/* Release the memory for the old elements array */ /* Release the memory for the old elements array */
isc_mem_put(dest->mctx, dest->elements, isc_mem_put(dest->mctx, dest->elements,

View File

@ -888,12 +888,12 @@ import_rdataset(dns_adbname_t *adbname, dns_rdataset_t *rdataset,
dns_rdataset_current(rdataset, &rdata); dns_rdataset_current(rdataset, &rdata);
if (rdtype == dns_rdatatype_a) { if (rdtype == dns_rdatatype_a) {
INSIST(rdata.length == 4); INSIST(rdata.length == 4);
memcpy(&ina.s_addr, rdata.data, 4); memmove(&ina.s_addr, rdata.data, 4);
isc_sockaddr_fromin(&sockaddr, &ina, 0); isc_sockaddr_fromin(&sockaddr, &ina, 0);
hookhead = &adbname->v4; hookhead = &adbname->v4;
} else { } else {
INSIST(rdata.length == 16); INSIST(rdata.length == 16);
memcpy(in6a.s6_addr, rdata.data, 16); memmove(in6a.s6_addr, rdata.data, 16);
isc_sockaddr_fromin6(&sockaddr, &in6a, 0); isc_sockaddr_fromin6(&sockaddr, &in6a, 0);
hookhead = &adbname->v6; hookhead = &adbname->v6;
} }

View File

@ -79,7 +79,7 @@ dns_difftuple_create(isc_mem_t *mctx,
datap = (unsigned char *)(t + 1); datap = (unsigned char *)(t + 1);
memcpy(datap, name->ndata, name->length); memmove(datap, name->ndata, name->length);
dns_name_init(&t->name, NULL); dns_name_init(&t->name, NULL);
dns_name_clone(name, &t->name); dns_name_clone(name, &t->name);
t->name.ndata = datap; t->name.ndata = datap;
@ -87,7 +87,7 @@ dns_difftuple_create(isc_mem_t *mctx,
t->ttl = ttl; t->ttl = ttl;
memcpy(datap, rdata->data, rdata->length); memmove(datap, rdata->data, rdata->length);
dns_rdata_init(&t->rdata); dns_rdata_init(&t->rdata);
dns_rdata_clone(rdata, &t->rdata); dns_rdata_clone(rdata, &t->rdata);
t->rdata.data = datap; t->rdata.data = datap;

View File

@ -3679,7 +3679,7 @@ dns_dispatch_importrecv(dns_dispatch_t *disp, isc_event_t *event) {
isc_event_free(ISC_EVENT_PTR(&newsevent)); isc_event_free(ISC_EVENT_PTR(&newsevent));
return; return;
} }
memcpy(buf, sevent->region.base, sevent->n); memmove(buf, sevent->region.base, sevent->n);
newsevent->region.base = buf; newsevent->region.base = buf;
newsevent->region.length = disp->mgr->buffersize; newsevent->region.length = disp->mgr->buffersize;
newsevent->n = sevent->n; newsevent->n = sevent->n;

View File

@ -83,10 +83,10 @@ dns_dns64_create(isc_mem_t *mctx, isc_netaddr_t *prefix,
if (new == NULL) if (new == NULL)
return (ISC_R_NOMEMORY); return (ISC_R_NOMEMORY);
memset(new->bits, 0, sizeof(new->bits)); memset(new->bits, 0, sizeof(new->bits));
memcpy(new->bits, prefix->type.in6.s6_addr, prefixlen / 8); memmove(new->bits, prefix->type.in6.s6_addr, prefixlen / 8);
if (suffix != NULL) if (suffix != NULL)
memcpy(new->bits + nbytes, suffix->type.in6.s6_addr + nbytes, memmove(new->bits + nbytes, suffix->type.in6.s6_addr + nbytes,
16 - nbytes); 16 - nbytes);
new->clients = NULL; new->clients = NULL;
if (clients != NULL) if (clients != NULL)
dns_acl_attach(clients, &new->clients); dns_acl_attach(clients, &new->clients);
@ -155,7 +155,7 @@ dns_dns64_aaaafroma(const dns_dns64_t *dns64, const isc_netaddr_t *reqaddr,
struct in_addr ina; struct in_addr ina;
isc_netaddr_t netaddr; isc_netaddr_t netaddr;
memcpy(&ina.s_addr, a, 4); memmove(&ina.s_addr, a, 4);
isc_netaddr_fromin(&netaddr, &ina); isc_netaddr_fromin(&netaddr, &ina);
result = dns_acl_match(&netaddr, NULL, dns64->mapped, env, result = dns_acl_match(&netaddr, NULL, dns64->mapped, env,
&match, NULL); &match, NULL);
@ -168,7 +168,7 @@ dns_dns64_aaaafroma(const dns_dns64_t *dns64, const isc_netaddr_t *reqaddr,
nbytes = dns64->prefixlen / 8; nbytes = dns64->prefixlen / 8;
INSIST(nbytes <= 12); INSIST(nbytes <= 12);
/* Copy prefix. */ /* Copy prefix. */
memcpy(aaaa, dns64->bits, nbytes); memmove(aaaa, dns64->bits, nbytes);
/* Bits 64-71 are zeros. draft-ietf-behave-address-format-04 */ /* Bits 64-71 are zeros. draft-ietf-behave-address-format-04 */
if (nbytes == 8) if (nbytes == 8)
aaaa[nbytes++] = 0; aaaa[nbytes++] = 0;
@ -180,7 +180,7 @@ dns_dns64_aaaafroma(const dns_dns64_t *dns64, const isc_netaddr_t *reqaddr,
aaaa[nbytes++] = 0; aaaa[nbytes++] = 0;
} }
/* Copy suffix. */ /* Copy suffix. */
memcpy(aaaa + nbytes, dns64->bits + nbytes, 16 - nbytes); memmove(aaaa + nbytes, dns64->bits + nbytes, 16 - nbytes);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
@ -268,7 +268,7 @@ dns_dns64_aaaaok(const dns_dns64_t *dns64, const isc_netaddr_t *reqaddr,
if (aaaaok == NULL || !aaaaok[i]) { if (aaaaok == NULL || !aaaaok[i]) {
dns_rdataset_current(rdataset, &rdata); dns_rdataset_current(rdataset, &rdata);
memcpy(&in6.s6_addr, rdata.data, 16); memmove(&in6.s6_addr, rdata.data, 16);
isc_netaddr_fromin6(&netaddr, &in6); isc_netaddr_fromin6(&netaddr, &in6);
result = dns_acl_match(&netaddr, NULL, result = dns_acl_match(&netaddr, NULL,

View File

@ -295,7 +295,7 @@ dns_dnssec_sign(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key,
* Create an envelope for each rdata: <name|type|class|ttl>. * Create an envelope for each rdata: <name|type|class|ttl>.
*/ */
isc_buffer_init(&envbuf, data, sizeof(data)); isc_buffer_init(&envbuf, data, sizeof(data));
memcpy(data, r.base, r.length); memmove(data, r.base, r.length);
isc_buffer_add(&envbuf, r.length); isc_buffer_add(&envbuf, r.length);
isc_buffer_putuint16(&envbuf, set->type); isc_buffer_putuint16(&envbuf, set->type);
isc_buffer_putuint16(&envbuf, set->rdclass); isc_buffer_putuint16(&envbuf, set->rdclass);
@ -501,10 +501,10 @@ dns_dnssec_verify3(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key,
if (labels - sig.labels > 0) { if (labels - sig.labels > 0) {
isc_buffer_putuint8(&envbuf, 1); isc_buffer_putuint8(&envbuf, 1);
isc_buffer_putuint8(&envbuf, '*'); isc_buffer_putuint8(&envbuf, '*');
memcpy(data + 2, r.base, r.length); memmove(data + 2, r.base, r.length);
} }
else else
memcpy(data, r.base, r.length); memmove(data, r.base, r.length);
isc_buffer_add(&envbuf, r.length); isc_buffer_add(&envbuf, r.length);
isc_buffer_putuint16(&envbuf, set->type); isc_buffer_putuint16(&envbuf, set->type);
isc_buffer_putuint16(&envbuf, set->rdclass); isc_buffer_putuint16(&envbuf, set->rdclass);
@ -1040,14 +1040,14 @@ dns_dnssec_verifymessage(isc_buffer_t *source, dns_message_t *msg,
/* /*
* Extract the header. * Extract the header.
*/ */
memcpy(header, source_r.base, DNS_MESSAGE_HEADERLEN); memmove(header, source_r.base, DNS_MESSAGE_HEADERLEN);
/* /*
* Decrement the additional field counter. * Decrement the additional field counter.
*/ */
memcpy(&addcount, &header[DNS_MESSAGE_HEADERLEN - 2], 2); memmove(&addcount, &header[DNS_MESSAGE_HEADERLEN - 2], 2);
addcount = htons((isc_uint16_t)(ntohs(addcount) - 1)); addcount = htons((isc_uint16_t)(ntohs(addcount) - 1));
memcpy(&header[DNS_MESSAGE_HEADERLEN - 2], &addcount, 2); memmove(&header[DNS_MESSAGE_HEADERLEN - 2], &addcount, 2);
/* /*
* Digest the modified header. * Digest the modified header.

View File

@ -216,7 +216,7 @@ gssapi_verify(dst_context_t *dctx, const isc_region_t *sig) {
buf = isc_mem_allocate(dst__memory_pool, sig->length); buf = isc_mem_allocate(dst__memory_pool, sig->length);
if (buf == NULL) if (buf == NULL)
return (ISC_R_FAILURE); return (ISC_R_FAILURE);
memcpy(buf, sig->base, sig->length); memmove(buf, sig->base, sig->length);
r.base = buf; r.base = buf;
r.length = sig->length; r.length = sig->length;
REGION_TO_GBUFFER(r, gsig); REGION_TO_GBUFFER(r, gsig);

View File

@ -228,9 +228,8 @@ hmacmd5_fromdns(dst_key_t *key, isc_buffer_t *data) {
isc_md5_update(&md5ctx, r.base, r.length); isc_md5_update(&md5ctx, r.base, r.length);
isc_md5_final(&md5ctx, hkey->key); isc_md5_final(&md5ctx, hkey->key);
keylen = ISC_MD5_DIGESTLENGTH; keylen = ISC_MD5_DIGESTLENGTH;
} } else {
else { memmove(hkey->key, r.base, r.length);
memcpy(hkey->key, r.base, r.length);
keylen = r.length; keylen = r.length;
} }
@ -505,9 +504,8 @@ hmacsha1_fromdns(dst_key_t *key, isc_buffer_t *data) {
isc_sha1_update(&sha1ctx, r.base, r.length); isc_sha1_update(&sha1ctx, r.base, r.length);
isc_sha1_final(&sha1ctx, hkey->key); isc_sha1_final(&sha1ctx, hkey->key);
keylen = ISC_SHA1_DIGESTLENGTH; keylen = ISC_SHA1_DIGESTLENGTH;
} } else {
else { memmove(hkey->key, r.base, r.length);
memcpy(hkey->key, r.base, r.length);
keylen = r.length; keylen = r.length;
} }
@ -784,9 +782,8 @@ hmacsha224_fromdns(dst_key_t *key, isc_buffer_t *data) {
isc_sha224_update(&sha224ctx, r.base, r.length); isc_sha224_update(&sha224ctx, r.base, r.length);
isc_sha224_final(hkey->key, &sha224ctx); isc_sha224_final(hkey->key, &sha224ctx);
keylen = ISC_SHA224_DIGESTLENGTH; keylen = ISC_SHA224_DIGESTLENGTH;
} } else {
else { memmove(hkey->key, r.base, r.length);
memcpy(hkey->key, r.base, r.length);
keylen = r.length; keylen = r.length;
} }
@ -1063,9 +1060,8 @@ hmacsha256_fromdns(dst_key_t *key, isc_buffer_t *data) {
isc_sha256_update(&sha256ctx, r.base, r.length); isc_sha256_update(&sha256ctx, r.base, r.length);
isc_sha256_final(hkey->key, &sha256ctx); isc_sha256_final(hkey->key, &sha256ctx);
keylen = ISC_SHA256_DIGESTLENGTH; keylen = ISC_SHA256_DIGESTLENGTH;
} } else {
else { memmove(hkey->key, r.base, r.length);
memcpy(hkey->key, r.base, r.length);
keylen = r.length; keylen = r.length;
} }
@ -1342,9 +1338,8 @@ hmacsha384_fromdns(dst_key_t *key, isc_buffer_t *data) {
isc_sha384_update(&sha384ctx, r.base, r.length); isc_sha384_update(&sha384ctx, r.base, r.length);
isc_sha384_final(hkey->key, &sha384ctx); isc_sha384_final(hkey->key, &sha384ctx);
keylen = ISC_SHA384_DIGESTLENGTH; keylen = ISC_SHA384_DIGESTLENGTH;
} } else {
else { memmove(hkey->key, r.base, r.length);
memcpy(hkey->key, r.base, r.length);
keylen = r.length; keylen = r.length;
} }
@ -1621,9 +1616,8 @@ hmacsha512_fromdns(dst_key_t *key, isc_buffer_t *data) {
isc_sha512_update(&sha512ctx, r.base, r.length); isc_sha512_update(&sha512ctx, r.base, r.length);
isc_sha512_final(hkey->key, &sha512ctx); isc_sha512_final(hkey->key, &sha512ctx);
keylen = ISC_SHA512_DIGESTLENGTH; keylen = ISC_SHA512_DIGESTLENGTH;
} } else {
else { memmove(hkey->key, r.base, r.length);
memcpy(hkey->key, r.base, r.length);
keylen = r.length; keylen = r.length;
} }

View File

@ -357,7 +357,7 @@ journal_pos_encode(journal_rawpos_t *raw, journal_pos_t *cooked) {
static void static void
journal_header_decode(journal_rawheader_t *raw, journal_header_t *cooked) { journal_header_decode(journal_rawheader_t *raw, journal_header_t *cooked) {
INSIST(sizeof(cooked->format) == sizeof(raw->h.format)); INSIST(sizeof(cooked->format) == sizeof(raw->h.format));
memcpy(cooked->format, raw->h.format, sizeof(cooked->format)); memmove(cooked->format, raw->h.format, sizeof(cooked->format));
journal_pos_decode(&raw->h.begin, &cooked->begin); journal_pos_decode(&raw->h.begin, &cooked->begin);
journal_pos_decode(&raw->h.end, &cooked->end); journal_pos_decode(&raw->h.end, &cooked->end);
cooked->index_size = decode_uint32(raw->h.index_size); cooked->index_size = decode_uint32(raw->h.index_size);
@ -371,7 +371,7 @@ journal_header_encode(journal_header_t *cooked, journal_rawheader_t *raw) {
INSIST(sizeof(cooked->format) == sizeof(raw->h.format)); INSIST(sizeof(cooked->format) == sizeof(raw->h.format));
memset(raw->pad, 0, sizeof(raw->pad)); memset(raw->pad, 0, sizeof(raw->pad));
memcpy(raw->h.format, cooked->format, sizeof(raw->h.format)); memmove(raw->h.format, cooked->format, sizeof(raw->h.format));
journal_pos_encode(&raw->h.begin, &cooked->begin); journal_pos_encode(&raw->h.begin, &cooked->begin);
journal_pos_encode(&raw->h.end, &cooked->end); journal_pos_encode(&raw->h.end, &cooked->end);
encode_uint32(cooked->index_size, raw->h.index_size); encode_uint32(cooked->index_size, raw->h.index_size);
@ -529,7 +529,7 @@ journal_file_create(isc_mem_t *mctx, const char *filename) {
return (ISC_R_NOMEMORY); return (ISC_R_NOMEMORY);
} }
memset(mem, 0, size); memset(mem, 0, size);
memcpy(mem, &rawheader, sizeof(rawheader)); memmove(mem, &rawheader, sizeof(rawheader));
result = isc_stdio_write(mem, 1, (size_t) size, fp, NULL); result = isc_stdio_write(mem, 1, (size_t) size, fp, NULL);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {

View File

@ -51,7 +51,7 @@ dns_keydata_todnskey(dns_rdata_keydata_t *keydata,
dnskey->data = isc_mem_allocate(mctx, dnskey->datalen); dnskey->data = isc_mem_allocate(mctx, dnskey->datalen);
if (dnskey->data == NULL) if (dnskey->data == NULL)
return (ISC_R_NOMEMORY); return (ISC_R_NOMEMORY);
memcpy(dnskey->data, keydata->data, dnskey->datalen); memmove(dnskey->data, keydata->data, dnskey->datalen);
} }
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
@ -82,7 +82,7 @@ dns_keydata_fromdnskey(dns_rdata_keydata_t *keydata,
keydata->data = isc_mem_allocate(mctx, keydata->datalen); keydata->data = isc_mem_allocate(mctx, keydata->datalen);
if (keydata->data == NULL) if (keydata->data == NULL)
return (ISC_R_NOMEMORY); return (ISC_R_NOMEMORY);
memcpy(keydata->data, dnskey->data, keydata->datalen); memmove(keydata->data, dnskey->data, keydata->datalen);
} }
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);

View File

@ -246,7 +246,7 @@ indent(unsigned int *current, unsigned int to, int tabwidth,
int n = t; int n = t;
if (n > N_TABS) if (n > N_TABS)
n = N_TABS; n = N_TABS;
memcpy(p, tabs, n); memmove(p, tabs, n);
p += n; p += n;
t -= n; t -= n;
} }
@ -267,7 +267,7 @@ indent(unsigned int *current, unsigned int to, int tabwidth,
int n = t; int n = t;
if (n > N_SPACES) if (n > N_SPACES)
n = N_SPACES; n = N_SPACES;
memcpy(p, spaces, n); memmove(p, spaces, n);
p += n; p += n;
t -= n; t -= n;
} }
@ -357,7 +357,7 @@ str_totext(const char *source, isc_buffer_t *target) {
if (l > region.length) if (l > region.length)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(region.base, source, l); memmove(region.base, source, l);
isc_buffer_add(target, l); isc_buffer_add(target, l);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
@ -474,7 +474,7 @@ rdataset_totext(dns_rdataset_t *rdataset,
isc_buffer_availableregion(target, &r); isc_buffer_availableregion(target, &r);
if (r.length < length) if (r.length < length)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(r.base, ttlbuf, length); memmove(r.base, ttlbuf, length);
isc_buffer_add(target, length); isc_buffer_add(target, length);
column += length; column += length;

View File

@ -1675,8 +1675,8 @@ dns_message_parse(dns_message_t *msg, isc_buffer_t *source,
msg->saved.base = isc_mem_get(msg->mctx, msg->saved.length); msg->saved.base = isc_mem_get(msg->mctx, msg->saved.length);
if (msg->saved.base == NULL) if (msg->saved.base == NULL)
return (ISC_R_NOMEMORY); return (ISC_R_NOMEMORY);
memcpy(msg->saved.base, isc_buffer_base(&origsource), memmove(msg->saved.base, isc_buffer_base(&origsource),
msg->saved.length); msg->saved.length);
msg->free_saved = 1; msg->free_saved = 1;
} }
@ -1748,7 +1748,7 @@ dns_message_renderchangebuffer(dns_message_t *msg, isc_buffer_t *buffer) {
* Copy the contents from the old to the new buffer. * Copy the contents from the old to the new buffer.
*/ */
isc_buffer_add(buffer, r.length); isc_buffer_add(buffer, r.length);
memcpy(rn.base, r.base, r.length); memmove(rn.base, r.base, r.length);
msg->buffer = buffer; msg->buffer = buffer;

View File

@ -1011,8 +1011,8 @@ dns_name_clone(const dns_name_t *source, dns_name_t *target) {
DNS_NAMEATTR_DYNOFFSETS); DNS_NAMEATTR_DYNOFFSETS);
if (target->offsets != NULL && source->labels > 0) { if (target->offsets != NULL && source->labels > 0) {
if (source->offsets != NULL) if (source->offsets != NULL)
memcpy(target->offsets, source->offsets, memmove(target->offsets, source->offsets,
source->labels); source->labels);
else else
set_offsets(target, target->offsets, NULL); set_offsets(target, target->offsets, NULL);
} }
@ -1041,7 +1041,7 @@ dns_name_fromregion(dns_name_t *name, const isc_region_t *r) {
len = (r->length < r2.length) ? r->length : r2.length; len = (r->length < r2.length) ? r->length : r2.length;
if (len > DNS_NAME_MAXWIRE) if (len > DNS_NAME_MAXWIRE)
len = DNS_NAME_MAXWIRE; len = DNS_NAME_MAXWIRE;
memcpy(r2.base, r->base, len); memmove(r2.base, r->base, len);
name->ndata = r2.base; name->ndata = r2.base;
name->length = len; name->length = len;
} else { } else {
@ -2025,8 +2025,8 @@ dns_name_towire(const dns_name_t *name, dns_compress_t *cctx,
if (gf) { if (gf) {
if (target->length - target->used < gp.length) if (target->length - target->used < gp.length)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
(void)memcpy((unsigned char *)target->base + target->used, (void)memmove((unsigned char *)target->base + target->used,
gp.ndata, (size_t)gp.length); gp.ndata, (size_t)gp.length);
isc_buffer_add(target, gp.length); isc_buffer_add(target, gp.length);
go |= 0xc000; go |= 0xc000;
if (target->length - target->used < 2) if (target->length - target->used < 2)
@ -2037,8 +2037,8 @@ dns_name_towire(const dns_name_t *name, dns_compress_t *cctx,
} else { } else {
if (target->length - target->used < name->length) if (target->length - target->used < name->length)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
(void)memcpy((unsigned char *)target->base + target->used, (void)memmove((unsigned char *)target->base + target->used,
name->ndata, (size_t)name->length); name->ndata, (size_t)name->length);
isc_buffer_add(target, name->length); isc_buffer_add(target, name->length);
dns_compress_add(cctx, name, name, offset); dns_compress_add(cctx, name, name, offset);
} }
@ -2122,8 +2122,8 @@ dns_name_concatenate(dns_name_t *prefix, dns_name_t *suffix, dns_name_t *name,
memmove(ndata + prefix_length, suffix->ndata, memmove(ndata + prefix_length, suffix->ndata,
suffix->length); suffix->length);
else else
memcpy(ndata + prefix_length, suffix->ndata, memmove(ndata + prefix_length, suffix->ndata,
suffix->length); suffix->length);
} }
/* /*
@ -2132,7 +2132,7 @@ dns_name_concatenate(dns_name_t *prefix, dns_name_t *suffix, dns_name_t *name,
* copy anything. * copy anything.
*/ */
if (copy_prefix && (prefix != name || prefix->buffer != target)) if (copy_prefix && (prefix != name || prefix->buffer != target))
memcpy(ndata, prefix->ndata, prefix_length); memmove(ndata, prefix->ndata, prefix_length);
name->ndata = ndata; name->ndata = ndata;
name->labels = labels; name->labels = labels;
@ -2206,7 +2206,7 @@ dns_name_dup(const dns_name_t *source, isc_mem_t *mctx,
if (target->ndata == NULL) if (target->ndata == NULL)
return (ISC_R_NOMEMORY); return (ISC_R_NOMEMORY);
memcpy(target->ndata, source->ndata, source->length); memmove(target->ndata, source->ndata, source->length);
target->length = source->length; target->length = source->length;
target->labels = source->labels; target->labels = source->labels;
@ -2215,8 +2215,8 @@ dns_name_dup(const dns_name_t *source, isc_mem_t *mctx,
target->attributes |= DNS_NAMEATTR_ABSOLUTE; target->attributes |= DNS_NAMEATTR_ABSOLUTE;
if (target->offsets != NULL) { if (target->offsets != NULL) {
if (source->offsets != NULL) if (source->offsets != NULL)
memcpy(target->offsets, source->offsets, memmove(target->offsets, source->offsets,
source->labels); source->labels);
else else
set_offsets(target, target->offsets, NULL); set_offsets(target, target->offsets, NULL);
} }
@ -2248,7 +2248,7 @@ dns_name_dupwithoffsets(dns_name_t *source, isc_mem_t *mctx,
if (target->ndata == NULL) if (target->ndata == NULL)
return (ISC_R_NOMEMORY); return (ISC_R_NOMEMORY);
memcpy(target->ndata, source->ndata, source->length); memmove(target->ndata, source->ndata, source->length);
target->length = source->length; target->length = source->length;
target->labels = source->labels; target->labels = source->labels;
@ -2258,7 +2258,7 @@ dns_name_dupwithoffsets(dns_name_t *source, isc_mem_t *mctx,
target->attributes |= DNS_NAMEATTR_ABSOLUTE; target->attributes |= DNS_NAMEATTR_ABSOLUTE;
target->offsets = target->ndata + source->length; target->offsets = target->ndata + source->length;
if (source->offsets != NULL) if (source->offsets != NULL)
memcpy(target->offsets, source->offsets, source->labels); memmove(target->offsets, source->offsets, source->labels);
else else
set_offsets(target, target->offsets, NULL); set_offsets(target, target->offsets, NULL);
@ -2438,7 +2438,7 @@ dns_name_tostring(dns_name_t *name, char **target, isc_mem_t *mctx) {
isc_buffer_usedregion(&buf, &reg); isc_buffer_usedregion(&buf, &reg);
p = isc_mem_allocate(mctx, reg.length + 1); p = isc_mem_allocate(mctx, reg.length + 1);
memcpy(p, (char *) reg.base, (int) reg.length); memmove(p, (char *) reg.base, (int) reg.length);
p[reg.length] = '\0'; p[reg.length] = '\0';
*target = p; *target = p;
@ -2514,7 +2514,7 @@ dns_name_copy(dns_name_t *source, dns_name_t *dest, isc_buffer_t *target) {
ndata = (unsigned char *)target->base + target->used; ndata = (unsigned char *)target->base + target->used;
dest->ndata = target->base; dest->ndata = target->base;
memcpy(ndata, source->ndata, source->length); memmove(ndata, source->ndata, source->length);
dest->ndata = ndata; dest->ndata = ndata;
dest->labels = source->labels; dest->labels = source->labels;
@ -2526,7 +2526,7 @@ dns_name_copy(dns_name_t *source, dns_name_t *dest, isc_buffer_t *target) {
if (dest->labels > 0 && dest->offsets != NULL) { if (dest->labels > 0 && dest->offsets != NULL) {
if (source->offsets != NULL) if (source->offsets != NULL)
memcpy(dest->offsets, source->offsets, source->labels); memmove(dest->offsets, source->offsets, source->labels);
else else
set_offsets(dest, dest->offsets, NULL); set_offsets(dest, dest->offsets, NULL);
} }

View File

@ -115,7 +115,7 @@ dns_nsec_buildrdata(dns_db_t *db, dns_dbversion_t *version,
memset(buffer, 0, DNS_NSEC_BUFFERSIZE); memset(buffer, 0, DNS_NSEC_BUFFERSIZE);
dns_name_toregion(target, &r); dns_name_toregion(target, &r);
memcpy(buffer, r.base, r.length); memmove(buffer, r.base, r.length);
r.base = buffer; r.base = buffer;
/* /*
* Use the end of the space for a raw bitmap leaving enough * Use the end of the space for a raw bitmap leaving enough

View File

@ -98,11 +98,11 @@ dns_nsec3_buildrdata(dns_db_t *db, dns_dbversion_t *version,
*p++ = iterations; *p++ = iterations;
*p++ = (unsigned char)salt_length; *p++ = (unsigned char)salt_length;
memcpy(p, salt, salt_length); memmove(p, salt, salt_length);
p += salt_length; p += salt_length;
*p++ = (unsigned char)hash_length; *p++ = (unsigned char)hash_length;
memcpy(p, nexthash, hash_length); memmove(p, nexthash, hash_length);
p += hash_length; p += hash_length;
r.length = (unsigned int)(p - buffer); r.length = (unsigned int)(p - buffer);
@ -591,7 +591,7 @@ dns_nsec3_addnsec3(dns_db_t *db, dns_dbversion_t *version,
flags = nsec3.flags; flags = nsec3.flags;
next_length = nsec3.next_length; next_length = nsec3.next_length;
INSIST(next_length <= sizeof(nexthash)); INSIST(next_length <= sizeof(nexthash));
memcpy(nexthash, nsec3.next, next_length); memmove(nexthash, nsec3.next, next_length);
dns_rdataset_disassociate(&rdataset); dns_rdataset_disassociate(&rdataset);
/* /*
* If the NSEC3 is not for a unsecure delegation then * If the NSEC3 is not for a unsecure delegation then
@ -688,7 +688,7 @@ dns_nsec3_addnsec3(dns_db_t *db, dns_dbversion_t *version,
rdataset.ttl, &rdata, &tuple)); rdataset.ttl, &rdata, &tuple));
CHECK(do_one_tuple(&tuple, db, version, diff)); CHECK(do_one_tuple(&tuple, db, version, diff));
INSIST(old_length <= sizeof(nexthash)); INSIST(old_length <= sizeof(nexthash));
memcpy(nexthash, old_next, old_length); memmove(nexthash, old_next, old_length);
if (!CREATE(nsec3param->flags)) if (!CREATE(nsec3param->flags))
flags = nsec3.flags; flags = nsec3.flags;
dns_rdata_reset(&rdata); dns_rdata_reset(&rdata);
@ -809,7 +809,7 @@ dns_nsec3_addnsec3(dns_db_t *db, dns_dbversion_t *version,
&tuple)); &tuple));
CHECK(do_one_tuple(&tuple, db, version, diff)); CHECK(do_one_tuple(&tuple, db, version, diff));
INSIST(old_length <= sizeof(nexthash)); INSIST(old_length <= sizeof(nexthash));
memcpy(nexthash, old_next, old_length); memmove(nexthash, old_next, old_length);
if (!CREATE(nsec3param->flags)) if (!CREATE(nsec3param->flags))
flags = nsec3.flags; flags = nsec3.flags;
dns_rdata_reset(&rdata); dns_rdata_reset(&rdata);
@ -958,7 +958,7 @@ dns_nsec3param_toprivate(dns_rdata_t *src, dns_rdata_t *target,
REQUIRE(DNS_RDATA_INITIALIZED(target)); REQUIRE(DNS_RDATA_INITIALIZED(target));
memcpy(buf + 1, src->data, src->length); memmove(buf + 1, src->data, src->length);
buf[0] = 0; buf[0] = 0;
target->data = buf; target->data = buf;
target->length = src->length + 1; target->length = src->length + 1;
@ -1094,7 +1094,7 @@ dns_nsec3param_deletechains(dns_db_t *db, dns_dbversion_t *ver,
dns_rdata_reset(&rdata); dns_rdata_reset(&rdata);
dns_rdataset_current(&rdataset, &rdata); dns_rdataset_current(&rdataset, &rdata);
INSIST(rdata.length <= sizeof(buf)); INSIST(rdata.length <= sizeof(buf));
memcpy(buf, rdata.data, rdata.length); memmove(buf, rdata.data, rdata.length);
/* /*
* Private NSEC3 record length >= 6. * Private NSEC3 record length >= 6.
@ -1357,7 +1357,7 @@ dns_nsec3_delnsec3(dns_db_t *db, dns_dbversion_t *version, dns_name_t *name,
if (result == ISC_R_SUCCESS) { if (result == ISC_R_SUCCESS) {
next_length = nsec3.next_length; next_length = nsec3.next_length;
INSIST(next_length <= sizeof(nexthash)); INSIST(next_length <= sizeof(nexthash));
memcpy(nexthash, nsec3.next, next_length); memmove(nexthash, nsec3.next, next_length);
} }
dns_rdataset_disassociate(&rdataset); dns_rdataset_disassociate(&rdataset);
if (result == ISC_R_NOMORE) if (result == ISC_R_NOMORE)
@ -1460,7 +1460,7 @@ dns_nsec3_delnsec3(dns_db_t *db, dns_dbversion_t *version, dns_name_t *name,
if (result == ISC_R_SUCCESS) { if (result == ISC_R_SUCCESS) {
next_length = nsec3.next_length; next_length = nsec3.next_length;
INSIST(next_length <= sizeof(nexthash)); INSIST(next_length <= sizeof(nexthash));
memcpy(nexthash, nsec3.next, next_length); memmove(nexthash, nsec3.next, next_length);
} }
dns_rdataset_disassociate(&rdataset); dns_rdataset_disassociate(&rdataset);
if (result == ISC_R_NOMORE) if (result == ISC_R_NOMORE)

View File

@ -371,7 +371,7 @@ opensslecdsa_todns(const dst_key_t *key, isc_buffer_t *data) {
cp = buf; cp = buf;
if (!i2o_ECPublicKey(eckey, &cp)) if (!i2o_ECPublicKey(eckey, &cp))
DST_RET (dst__openssl_toresult(ISC_R_FAILURE)); DST_RET (dst__openssl_toresult(ISC_R_FAILURE));
memcpy(r.base, buf + 1, len); memmove(r.base, buf + 1, len);
isc_buffer_add(data, len); isc_buffer_add(data, len);
ret = ISC_R_SUCCESS; ret = ISC_R_SUCCESS;
@ -414,7 +414,7 @@ opensslecdsa_fromdns(dst_key_t *key, isc_buffer_t *data) {
return (dst__openssl_toresult(DST_R_OPENSSLFAILURE)); return (dst__openssl_toresult(DST_R_OPENSSLFAILURE));
buf[0] = POINT_CONVERSION_UNCOMPRESSED; buf[0] = POINT_CONVERSION_UNCOMPRESSED;
memcpy(buf + 1, r.base, len); memmove(buf + 1, r.base, len);
cp = buf; cp = buf;
if (o2i_ECPublicKey(&eckey, if (o2i_ECPublicKey(&eckey,
(const unsigned char **) &cp, (const unsigned char **) &cp,

View File

@ -253,7 +253,7 @@ opensslgost_todns(const dst_key_t *key, isc_buffer_t *data) {
len = i2d_PUBKEY(pkey, &p); len = i2d_PUBKEY(pkey, &p);
INSIST(len == sizeof(der)); INSIST(len == sizeof(der));
INSIST(memcmp(gost_prefix, der, 37) == 0); INSIST(memcmp(gost_prefix, der, 37) == 0);
memcpy(r.base, der + 37, 64); memmove(r.base, der + 37, 64);
isc_buffer_add(data, 64); isc_buffer_add(data, 64);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
@ -272,8 +272,8 @@ opensslgost_fromdns(dst_key_t *key, isc_buffer_t *data) {
if (r.length != 64) if (r.length != 64)
return (DST_R_INVALIDPUBLICKEY); return (DST_R_INVALIDPUBLICKEY);
memcpy(der, gost_prefix, 37); memmove(der, gost_prefix, 37);
memcpy(der + 37, r.base, 64); memmove(der + 37, r.base, 64);
isc_buffer_forward(data, 64); isc_buffer_forward(data, 64);
p = der; p = der;

View File

@ -481,7 +481,7 @@ opensslrsa_sign(dst_context_t *dctx, isc_buffer_t *sig) {
INSIST(prefixlen + digestlen <= sizeof(digest)); INSIST(prefixlen + digestlen <= sizeof(digest));
memmove(digest + prefixlen, digest, digestlen); memmove(digest + prefixlen, digest, digestlen);
memcpy(digest, prefix, prefixlen); memmove(digest, prefix, prefixlen);
status = RSA_private_encrypt(digestlen + prefixlen, status = RSA_private_encrypt(digestlen + prefixlen,
digest, r.base, rsa, digest, r.base, rsa,
RSA_PKCS1_PADDING); RSA_PKCS1_PADDING);

View File

@ -164,8 +164,8 @@ dns_portlist_add(dns_portlist_t *portlist, int af, in_port_t port) {
goto unlock; goto unlock;
} }
if (portlist->list != NULL) { if (portlist->list != NULL) {
memcpy(el, portlist->list, memmove(el, portlist->list,
portlist->allocated * sizeof(*el)); portlist->allocated * sizeof(*el));
isc_mem_put(portlist->mctx, portlist->list, isc_mem_put(portlist->mctx, portlist->list,
portlist->allocated * sizeof(*el)); portlist->allocated * sizeof(*el));
} }

View File

@ -429,8 +429,8 @@ write_header(FILE *file, dns_rbt_t *rbt, isc_uint64_t first_node_offset,
} }
memset(&header, 0, sizeof(file_header_t)); memset(&header, 0, sizeof(file_header_t));
memcpy(header.version1, FILE_VERSION, sizeof(header.version1)); memmove(header.version1, FILE_VERSION, sizeof(header.version1));
memcpy(header.version2, FILE_VERSION, sizeof(header.version2)); memmove(header.version2, FILE_VERSION, sizeof(header.version2));
header.first_node_offset = first_node_offset; header.first_node_offset = first_node_offset;
header.ptrsize = (isc_uint32_t) sizeof(void *); header.ptrsize = (isc_uint32_t) sizeof(void *);
header.bigendian = (1 == htonl(1)) ? 1 : 0; header.bigendian = (1 == htonl(1)) ? 1 : 0;
@ -700,7 +700,7 @@ treefix(dns_rbt_t *rbt, void *base, size_t filesize, dns_rbtnode_t *n,
} }
/* memorize header contents prior to fixup */ /* memorize header contents prior to fixup */
memcpy(&header, n, sizeof(header)); memmove(&header, n, sizeof(header));
if (n->left_is_relative) { if (n->left_is_relative) {
CONFIRM(n->left <= (dns_rbtnode_t *) nodemax); CONFIRM(n->left <= (dns_rbtnode_t *) nodemax);
@ -2141,8 +2141,8 @@ create_node(isc_mem_t *mctx, dns_name_t *name, dns_rbtnode_t **nodep) {
OLDOFFSETLEN(node) = OFFSETLEN(node) = labels; OLDOFFSETLEN(node) = OFFSETLEN(node) = labels;
ATTRS(node) = name->attributes; ATTRS(node) = name->attributes;
memcpy(NAME(node), region.base, region.length); memmove(NAME(node), region.base, region.length);
memcpy(OFFSETS(node), name->offsets, labels); memmove(OFFSETS(node), name->offsets, labels);
#if DNS_RBT_USEMAGIC #if DNS_RBT_USEMAGIC
node->magic = DNS_RBTNODE_MAGIC; node->magic = DNS_RBTNODE_MAGIC;
@ -2506,7 +2506,7 @@ deletefromlevel(dns_rbtnode_t *delete, dns_rbtnode_t **rootp) {
* information, which will be needed when linking up * information, which will be needed when linking up
* delete to the successor's old location. * delete to the successor's old location.
*/ */
memcpy(tmp, successor, sizeof(dns_rbtnode_t)); memmove(tmp, successor, sizeof(dns_rbtnode_t));
if (IS_ROOT(delete)) { if (IS_ROOT(delete)) {
*rootp = successor; *rootp = successor;

View File

@ -1243,8 +1243,8 @@ newversion(dns_db_t *db, dns_dbversion_t **versionp) {
version->hash = rbtdb->current_version->hash; version->hash = rbtdb->current_version->hash;
version->salt_length = version->salt_length =
rbtdb->current_version->salt_length; rbtdb->current_version->salt_length;
memcpy(version->salt, rbtdb->current_version->salt, memmove(version->salt, rbtdb->current_version->salt,
version->salt_length); version->salt_length);
} else { } else {
version->flags = 0; version->flags = 0;
version->iterations = 0; version->iterations = 0;
@ -2284,8 +2284,8 @@ setnsec3parameters(dns_db_t *db, rbtdb_version_t *version) {
if (nsec3param.flags != 0) if (nsec3param.flags != 0)
continue; continue;
memcpy(version->salt, nsec3param.salt, memmove(version->salt, nsec3param.salt,
nsec3param.salt_length); nsec3param.salt_length);
version->hash = nsec3param.hash; version->hash = nsec3param.hash;
version->salt_length = nsec3param.salt_length; version->salt_length = nsec3param.salt_length;
version->iterations = nsec3param.iterations; version->iterations = nsec3param.iterations;
@ -7314,7 +7314,7 @@ rbt_datawriter(FILE *rbtfile, unsigned char *data, void *arg,
sizeof(rdatasetheader_t)); sizeof(rdatasetheader_t));
p = (unsigned char *) header; p = (unsigned char *) header;
memcpy(&newheader, p, sizeof(rdatasetheader_t)); memmove(&newheader, p, sizeof(rdatasetheader_t));
newheader.down = NULL; newheader.down = NULL;
newheader.next = NULL; newheader.next = NULL;
off = where; off = where;
@ -7401,8 +7401,8 @@ rbtdb_write_header(FILE *rbtfile, off_t tree_location, off_t nsec_location,
} }
memset(&header, 0, sizeof(rbtdb_file_header_t)); memset(&header, 0, sizeof(rbtdb_file_header_t));
memcpy(header.version1, FILE_VERSION, sizeof(header.version1)); memmove(header.version1, FILE_VERSION, sizeof(header.version1));
memcpy(header.version2, FILE_VERSION, sizeof(header.version2)); memmove(header.version2, FILE_VERSION, sizeof(header.version2));
header.ptrsize = (isc_uint32_t) sizeof(void *); header.ptrsize = (isc_uint32_t) sizeof(void *);
header.bigendian = (1 == htonl(1)) ? 1 : 0; header.bigendian = (1 == htonl(1)) ? 1 : 0;
header.tree = (isc_uint64_t) tree_location; header.tree = (isc_uint64_t) tree_location;
@ -7627,7 +7627,8 @@ getnsec3parameters(dns_db_t *db, dns_dbversion_t *version, dns_hash_t *hash,
*hash = rbtversion->hash; *hash = rbtversion->hash;
if (salt != NULL && salt_length != NULL) { if (salt != NULL && salt_length != NULL) {
REQUIRE(*salt_length >= rbtversion->salt_length); REQUIRE(*salt_length >= rbtversion->salt_length);
memcpy(salt, rbtversion->salt, rbtversion->salt_length); memmove(salt, rbtversion->salt,
rbtversion->salt_length);
} }
if (salt_length != NULL) if (salt_length != NULL)
*salt_length = rbtversion->salt_length; *salt_length = rbtversion->salt_length;

View File

@ -206,7 +206,7 @@ str_totext(const char *source, isc_buffer_t *target) {
if (l > region.length) if (l > region.length)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(region.base, source, l); memmove(region.base, source, l);
isc_buffer_add(target, l); isc_buffer_add(target, l);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }

View File

@ -282,7 +282,7 @@ locator_pton(const char *src, unsigned char *dst) {
} }
if (tp != endp) if (tp != endp)
return (0); return (0);
memcpy(dst, tmp, NS_LOCATORSZ); memmove(dst, tmp, NS_LOCATORSZ);
return (1); return (1);
} }
@ -323,7 +323,7 @@ mem_maybedup(isc_mem_t *mctx, void *source, size_t length) {
return (source); return (source);
new = isc_mem_allocate(mctx, length); new = isc_mem_allocate(mctx, length);
if (new != NULL) if (new != NULL)
memcpy(new, source, length); memmove(new, source, length);
return (new); return (new);
} }
@ -590,7 +590,7 @@ dns_rdata_towire(dns_rdata_t *rdata, dns_compress_t *cctx,
isc_buffer_availableregion(target, &tr); isc_buffer_availableregion(target, &tr);
if (tr.length < rdata->length) if (tr.length < rdata->length)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(tr.base, rdata->data, rdata->length); memmove(tr.base, rdata->data, rdata->length);
isc_buffer_add(target, rdata->length); isc_buffer_add(target, rdata->length);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
@ -1269,7 +1269,7 @@ txt_fromwire(isc_buffer_t *source, isc_buffer_t *target) {
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
if (tregion.base != sregion.base) if (tregion.base != sregion.base)
memcpy(tregion.base, sregion.base, n); memmove(tregion.base, sregion.base, n);
isc_buffer_forward(source, n); isc_buffer_forward(source, n);
isc_buffer_add(target, n); isc_buffer_add(target, n);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
@ -1419,7 +1419,7 @@ multitxt_fromwire(isc_buffer_t *source, isc_buffer_t *target) {
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
if (tregion.base != sregion.base) if (tregion.base != sregion.base)
memcpy(tregion.base, sregion.base, n); memmove(tregion.base, sregion.base, n);
isc_buffer_forward(source, n); isc_buffer_forward(source, n);
isc_buffer_add(target, n); isc_buffer_add(target, n);
isc_buffer_activeregion(source, &sregion); isc_buffer_activeregion(source, &sregion);
@ -1470,7 +1470,7 @@ str_totext(const char *source, isc_buffer_t *target) {
if (l > region.length) if (l > region.length)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(region.base, source, l); memmove(region.base, source, l);
isc_buffer_add(target, l); isc_buffer_add(target, l);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
@ -1596,7 +1596,7 @@ mem_tobuffer(isc_buffer_t *target, void *base, unsigned int length) {
if (length > tr.length) if (length > tr.length)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
if (tr.base != base) if (tr.base != base)
memcpy(tr.base, base, length); memmove(tr.base, base, length);
isc_buffer_add(target, length); isc_buffer_add(target, length);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }

View File

@ -117,7 +117,7 @@ fromwire_ch_a(ARGS_FROMWIRE) {
if (tregion.length < 2) if (tregion.length < 2)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(tregion.base, sregion.base, 2); memmove(tregion.base, sregion.base, 2);
isc_buffer_forward(source, 2); isc_buffer_forward(source, 2);
isc_buffer_add(target, 2); isc_buffer_add(target, 2);
@ -149,7 +149,7 @@ towire_ch_a(ARGS_TOWIRE) {
if (tregion.length < 2) if (tregion.length < 2)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(tregion.base, sregion.base, 2); memmove(tregion.base, sregion.base, 2);
isc_buffer_add(target, 2); isc_buffer_add(target, 2);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }

View File

@ -113,7 +113,7 @@ fromwire_afsdb(ARGS_FROMWIRE) {
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
if (sr.length < 2) if (sr.length < 2)
return (ISC_R_UNEXPECTEDEND); return (ISC_R_UNEXPECTEDEND);
memcpy(tr.base, sr.base, 2); memmove(tr.base, sr.base, 2);
isc_buffer_forward(source, 2); isc_buffer_forward(source, 2);
isc_buffer_add(target, 2); isc_buffer_add(target, 2);
return (dns_name_fromwire(&name, source, dctx, options, target)); return (dns_name_fromwire(&name, source, dctx, options, target));
@ -134,7 +134,7 @@ towire_afsdb(ARGS_TOWIRE) {
dns_rdata_toregion(rdata, &sr); dns_rdata_toregion(rdata, &sr);
if (tr.length < 2) if (tr.length < 2)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(tr.base, sr.base, 2); memmove(tr.base, sr.base, 2);
isc_region_consume(&sr, 2); isc_region_consume(&sr, 2);
isc_buffer_add(target, 2); isc_buffer_add(target, 2);

View File

@ -142,7 +142,7 @@ tostruct_eui48(ARGS_TOSTRUCT) {
eui48->common.rdtype = rdata->type; eui48->common.rdtype = rdata->type;
ISC_LINK_INIT(&eui48->common, link); ISC_LINK_INIT(&eui48->common, link);
memcpy(eui48->eui48, rdata->data, rdata->length); memmove(eui48->eui48, rdata->data, rdata->length);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }

View File

@ -147,7 +147,7 @@ tostruct_eui64(ARGS_TOSTRUCT) {
eui64->common.rdtype = rdata->type; eui64->common.rdtype = rdata->type;
ISC_LINK_INIT(&eui64->common, link); ISC_LINK_INIT(&eui64->common, link);
memcpy(eui64->eui64, rdata->data, rdata->length); memmove(eui64->eui64, rdata->data, rdata->length);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }

View File

@ -87,7 +87,7 @@ fromtext_ipseckey(ARGS_FROMTEXT) {
isc_buffer_availableregion(target, &region); isc_buffer_availableregion(target, &region);
if (region.length < 4) if (region.length < 4)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(region.base, &addr, 4); memmove(region.base, &addr, 4);
isc_buffer_add(target, 4); isc_buffer_add(target, 4);
break; break;
@ -97,7 +97,7 @@ fromtext_ipseckey(ARGS_FROMTEXT) {
isc_buffer_availableregion(target, &region); isc_buffer_availableregion(target, &region);
if (region.length < 16) if (region.length < 16)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(region.base, addr6, 16); memmove(region.base, addr6, 16);
isc_buffer_add(target, 16); isc_buffer_add(target, 16);
break; break;
@ -364,7 +364,7 @@ tostruct_ipseckey(ARGS_TOSTRUCT) {
break; break;
case 2: case 2:
memcpy(ipseckey->in6_addr.s6_addr, region.base, 16); memmove(ipseckey->in6_addr.s6_addr, region.base, 16);
isc_region_consume(&region, 16); isc_region_consume(&region, 16);
break; break;

View File

@ -51,7 +51,7 @@ fromtext_l32(ARGS_FROMTEXT) {
isc_buffer_availableregion(target, &region); isc_buffer_availableregion(target, &region);
if (region.length < 4) if (region.length < 4)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(region.base, &addr, 4); memmove(region.base, &addr, 4);
isc_buffer_add(target, 4); isc_buffer_add(target, 4);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }

View File

@ -155,7 +155,7 @@ tostruct_l64(ARGS_TOSTRUCT) {
dns_rdata_toregion(rdata, &region); dns_rdata_toregion(rdata, &region);
l64->pref = uint16_fromregion(&region); l64->pref = uint16_fromregion(&region);
memcpy(l64->l64, region.base, region.length); memmove(l64->l64, region.base, region.length);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }

View File

@ -155,7 +155,7 @@ tostruct_nid(ARGS_TOSTRUCT) {
dns_rdata_toregion(rdata, &region); dns_rdata_toregion(rdata, &region);
nid->pref = uint16_fromregion(&region); nid->pref = uint16_fromregion(&region);
memcpy(nid->nid, region.base, region.length); memmove(nid->nid, region.base, region.length);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }

View File

@ -162,7 +162,7 @@ fromwire_opt(ARGS_FROMWIRE) {
isc_buffer_availableregion(target, &tregion); isc_buffer_availableregion(target, &tregion);
if (tregion.length < total) if (tregion.length < total)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(tregion.base, sregion.base, total); memmove(tregion.base, sregion.base, total);
isc_buffer_forward(source, total); isc_buffer_forward(source, total);
isc_buffer_add(target, total); isc_buffer_add(target, total);

View File

@ -109,7 +109,7 @@ fromwire_rt(ARGS_FROMWIRE) {
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
if (sregion.length < 2) if (sregion.length < 2)
return (ISC_R_UNEXPECTEDEND); return (ISC_R_UNEXPECTEDEND);
memcpy(tregion.base, sregion.base, 2); memmove(tregion.base, sregion.base, 2);
isc_buffer_forward(source, 2); isc_buffer_forward(source, 2);
isc_buffer_add(target, 2); isc_buffer_add(target, 2);
return (dns_name_fromwire(&name, source, dctx, options, target)); return (dns_name_fromwire(&name, source, dctx, options, target));
@ -130,7 +130,7 @@ towire_rt(ARGS_TOWIRE) {
dns_rdata_toregion(rdata, &region); dns_rdata_toregion(rdata, &region);
if (tr.length < 2) if (tr.length < 2)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(tr.base, region.base, 2); memmove(tr.base, region.base, 2);
isc_region_consume(&region, 2); isc_region_consume(&region, 2);
isc_buffer_add(target, 2); isc_buffer_add(target, 2);

View File

@ -186,7 +186,7 @@ fromwire_soa(ARGS_FROMWIRE) {
if (tregion.length < 20) if (tregion.length < 20)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(tregion.base, sregion.base, 20); memmove(tregion.base, sregion.base, 20);
isc_buffer_forward(source, 20); isc_buffer_forward(source, 20);
isc_buffer_add(target, 20); isc_buffer_add(target, 20);
@ -224,7 +224,7 @@ towire_soa(ARGS_TOWIRE) {
if (tregion.length < 20) if (tregion.length < 20)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(tregion.base, sregion.base, 20); memmove(tregion.base, sregion.base, 20);
isc_buffer_add(target, 20); isc_buffer_add(target, 20);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }

View File

@ -103,7 +103,7 @@ towire_spf(ARGS_TOWIRE) {
if (region.length < rdata->length) if (region.length < rdata->length)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(region.base, rdata->data, rdata->length); memmove(region.base, rdata->data, rdata->length);
isc_buffer_add(target, rdata->length); isc_buffer_add(target, rdata->length);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }

View File

@ -110,7 +110,7 @@ towire_txt(ARGS_TOWIRE) {
if (region.length < rdata->length) if (region.length < rdata->length)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(region.base, rdata->data, rdata->length); memmove(region.base, rdata->data, rdata->length);
isc_buffer_add(target, rdata->length); isc_buffer_add(target, rdata->length);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }

View File

@ -48,7 +48,7 @@ fromtext_hs_a(ARGS_FROMTEXT) {
isc_buffer_availableregion(target, &region); isc_buffer_availableregion(target, &region);
if (region.length < 4) if (region.length < 4)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(region.base, &addr, 4); memmove(region.base, &addr, 4);
isc_buffer_add(target, 4); isc_buffer_add(target, 4);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
@ -87,7 +87,7 @@ fromwire_hs_a(ARGS_FROMWIRE) {
if (tregion.length < 4) if (tregion.length < 4)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(tregion.base, sregion.base, 4); memmove(tregion.base, sregion.base, 4);
isc_buffer_forward(source, 4); isc_buffer_forward(source, 4);
isc_buffer_add(target, 4); isc_buffer_add(target, 4);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
@ -106,7 +106,7 @@ towire_hs_a(ARGS_TOWIRE) {
isc_buffer_availableregion(target, &region); isc_buffer_availableregion(target, &region);
if (region.length < rdata->length) if (region.length < rdata->length)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(region.base, rdata->data, rdata->length); memmove(region.base, rdata->data, rdata->length);
isc_buffer_add(target, 4); isc_buffer_add(target, 4);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }

View File

@ -122,7 +122,7 @@ totext_in_a6(ARGS_TOTEXT) {
if (prefixlen != 128) { if (prefixlen != 128) {
octets = prefixlen/8; octets = prefixlen/8;
memset(addr, 0, sizeof(addr)); memset(addr, 0, sizeof(addr));
memcpy(&addr[octets], sr.base, 16 - octets); memmove(&addr[octets], sr.base, 16 - octets);
mask = 0xff >> (prefixlen % 8); mask = 0xff >> (prefixlen % 8);
addr[octets] &= mask; addr[octets] &= mask;
ar.base = addr; ar.base = addr;
@ -347,7 +347,7 @@ tostruct_in_a6(ARGS_TOSTRUCT) {
if (a6->prefixlen != 128) { if (a6->prefixlen != 128) {
octets = 16 - a6->prefixlen / 8; octets = 16 - a6->prefixlen / 8;
INSIST(r.length >= octets); INSIST(r.length >= octets);
memcpy(a6->in6_addr.s6_addr + 16 - octets, r.base, octets); memmove(a6->in6_addr.s6_addr + 16 - octets, r.base, octets);
isc_region_consume(&r, octets); isc_region_consume(&r, octets);
} }

View File

@ -50,7 +50,7 @@ fromtext_in_a(ARGS_FROMTEXT) {
isc_buffer_availableregion(target, &region); isc_buffer_availableregion(target, &region);
if (region.length < 4) if (region.length < 4)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(region.base, &addr, 4); memmove(region.base, &addr, 4);
isc_buffer_add(target, 4); isc_buffer_add(target, 4);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
@ -89,7 +89,7 @@ fromwire_in_a(ARGS_FROMWIRE) {
if (tregion.length < 4) if (tregion.length < 4)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(tregion.base, sregion.base, 4); memmove(tregion.base, sregion.base, 4);
isc_buffer_forward(source, 4); isc_buffer_forward(source, 4);
isc_buffer_add(target, 4); isc_buffer_add(target, 4);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
@ -108,7 +108,7 @@ towire_in_a(ARGS_TOWIRE) {
isc_buffer_availableregion(target, &region); isc_buffer_availableregion(target, &region);
if (region.length < rdata->length) if (region.length < rdata->length)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(region.base, rdata->data, rdata->length); memmove(region.base, rdata->data, rdata->length);
isc_buffer_add(target, 4); isc_buffer_add(target, 4);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }

View File

@ -51,7 +51,7 @@ fromtext_in_aaaa(ARGS_FROMTEXT) {
isc_buffer_availableregion(target, &region); isc_buffer_availableregion(target, &region);
if (region.length < 16) if (region.length < 16)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(region.base, addr, 16); memmove(region.base, addr, 16);
isc_buffer_add(target, 16); isc_buffer_add(target, 16);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
@ -90,7 +90,7 @@ fromwire_in_aaaa(ARGS_FROMWIRE) {
if (tregion.length < 16) if (tregion.length < 16)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(tregion.base, sregion.base, 16); memmove(tregion.base, sregion.base, 16);
isc_buffer_forward(source, 16); isc_buffer_forward(source, 16);
isc_buffer_add(target, 16); isc_buffer_add(target, 16);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
@ -109,7 +109,7 @@ towire_in_aaaa(ARGS_TOWIRE) {
isc_buffer_availableregion(target, &region); isc_buffer_availableregion(target, &region);
if (region.length < rdata->length) if (region.length < rdata->length)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(region.base, rdata->data, rdata->length); memmove(region.base, rdata->data, rdata->length);
isc_buffer_add(target, 16); isc_buffer_add(target, 16);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
@ -165,7 +165,7 @@ tostruct_in_aaaa(ARGS_TOSTRUCT) {
dns_rdata_toregion(rdata, &r); dns_rdata_toregion(rdata, &r);
INSIST(r.length == 16); INSIST(r.length == 16);
memcpy(aaaa->in6_addr.s6_addr, r.base, 16); memmove(aaaa->in6_addr.s6_addr, r.base, 16);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }

View File

@ -148,7 +148,7 @@ totext_in_apl(ARGS_TOTEXT) {
INSIST(len <= 4); INSIST(len <= 4);
INSIST(prefix <= 32); INSIST(prefix <= 32);
memset(buf, 0, sizeof(buf)); memset(buf, 0, sizeof(buf));
memcpy(buf, sr.base, len); memmove(buf, sr.base, len);
RETERR(inet_totext(AF_INET, &ir, target)); RETERR(inet_totext(AF_INET, &ir, target));
break; break;
@ -156,7 +156,7 @@ totext_in_apl(ARGS_TOTEXT) {
INSIST(len <= 16); INSIST(len <= 16);
INSIST(prefix <= 128); INSIST(prefix <= 128);
memset(buf, 0, sizeof(buf)); memset(buf, 0, sizeof(buf));
memcpy(buf, sr.base, len); memmove(buf, sr.base, len);
RETERR(inet_totext(AF_INET6, &ir, target)); RETERR(inet_totext(AF_INET6, &ir, target));
break; break;

View File

@ -98,7 +98,7 @@ fromtext_in_wks(ARGS_FROMTEXT) {
RETTOK(DNS_R_BADDOTTEDQUAD); RETTOK(DNS_R_BADDOTTEDQUAD);
if (region.length < 4) if (region.length < 4)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(region.base, &addr, 4); memmove(region.base, &addr, 4);
isc_buffer_add(target, 4); isc_buffer_add(target, 4);
/* /*
@ -222,7 +222,7 @@ fromwire_in_wks(ARGS_FROMWIRE) {
if (tr.length < sr.length) if (tr.length < sr.length)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(tr.base, sr.base, sr.length); memmove(tr.base, sr.base, sr.length);
isc_buffer_add(target, sr.length); isc_buffer_add(target, sr.length);
isc_buffer_forward(source, sr.length); isc_buffer_forward(source, sr.length);

View File

@ -318,7 +318,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx,
*rawbuf++ |= (x[i].rdata.flags & DNS_RDATA_OFFLINE) ? *rawbuf++ |= (x[i].rdata.flags & DNS_RDATA_OFFLINE) ?
DNS_RDATASLAB_OFFLINE : 0; DNS_RDATASLAB_OFFLINE : 0;
} }
memcpy(rawbuf, x[i].rdata.data, x[i].rdata.length); memmove(rawbuf, x[i].rdata.data, x[i].rdata.length);
rawbuf += x[i].rdata.length; rawbuf += x[i].rdata.length;
} }
@ -711,7 +711,7 @@ dns_rdataslab_merge(unsigned char *oslab, unsigned char *nslab,
tstart = isc_mem_get(mctx, tlength); tstart = isc_mem_get(mctx, tlength);
if (tstart == NULL) if (tstart == NULL)
return (ISC_R_NOMEMORY); return (ISC_R_NOMEMORY);
memcpy(tstart, nslab, reservelen); memmove(tstart, nslab, reservelen);
tcurrent = tstart + reservelen; tcurrent = tstart + reservelen;
#if DNS_RDATASET_FIXED #if DNS_RDATASET_FIXED
offsetbase = tcurrent; offsetbase = tcurrent;
@ -790,7 +790,7 @@ dns_rdataslab_merge(unsigned char *oslab, unsigned char *nslab,
#if DNS_RDATASET_FIXED #if DNS_RDATASET_FIXED
tcurrent += 2; /* fill in later */ tcurrent += 2; /* fill in later */
#endif #endif
memcpy(tcurrent, data, length); memmove(tcurrent, data, length);
tcurrent += length; tcurrent += length;
oadded++; oadded++;
if (oadded < ocount) { if (oadded < ocount) {
@ -817,7 +817,7 @@ dns_rdataslab_merge(unsigned char *oslab, unsigned char *nslab,
#if DNS_RDATASET_FIXED #if DNS_RDATASET_FIXED
tcurrent += 2; /* fill in later */ tcurrent += 2; /* fill in later */
#endif #endif
memcpy(tcurrent, data, length); memmove(tcurrent, data, length);
tcurrent += length; tcurrent += length;
nadded++; nadded++;
if (nadded < ncount) { if (nadded < ncount) {
@ -949,7 +949,7 @@ dns_rdataslab_subtract(unsigned char *mslab, unsigned char *sslab,
tstart = isc_mem_get(mctx, tlength); tstart = isc_mem_get(mctx, tlength);
if (tstart == NULL) if (tstart == NULL)
return (ISC_R_NOMEMORY); return (ISC_R_NOMEMORY);
memcpy(tstart, mslab, reservelen); memmove(tstart, mslab, reservelen);
tcurrent = tstart + reservelen; tcurrent = tstart + reservelen;
#if DNS_RDATASET_FIXED #if DNS_RDATASET_FIXED
offsetbase = tcurrent; offsetbase = tcurrent;
@ -1005,7 +1005,7 @@ dns_rdataslab_subtract(unsigned char *mslab, unsigned char *sslab,
#if DNS_RDATASET_FIXED #if DNS_RDATASET_FIXED
offsettable[order] = tcurrent - offsetbase; offsettable[order] = tcurrent - offsetbase;
#endif #endif
memcpy(tcurrent, mrdatabegin, length); memmove(tcurrent, mrdatabegin, length);
tcurrent += length; tcurrent += length;
} }
dns_rdata_reset(&mrdata); dns_rdata_reset(&mrdata);

View File

@ -5579,11 +5579,11 @@ is_answeraddress_allowed(dns_view_t *view, dns_name_t *name,
dns_rdataset_current(rdataset, &rdata); dns_rdataset_current(rdataset, &rdata);
if (rdataset->type == dns_rdatatype_a) { if (rdataset->type == dns_rdatatype_a) {
INSIST(rdata.length == sizeof(ina.s_addr)); INSIST(rdata.length == sizeof(ina.s_addr));
memcpy(&ina.s_addr, rdata.data, sizeof(ina.s_addr)); memmove(&ina.s_addr, rdata.data, sizeof(ina.s_addr));
isc_netaddr_fromin(&netaddr, &ina); isc_netaddr_fromin(&netaddr, &ina);
} else { } else {
INSIST(rdata.length == sizeof(in6a.s6_addr)); INSIST(rdata.length == sizeof(in6a.s6_addr));
memcpy(in6a.s6_addr, rdata.data, sizeof(in6a.s6_addr)); memmove(in6a.s6_addr, rdata.data, sizeof(in6a.s6_addr));
isc_netaddr_fromin6(&netaddr, &in6a); isc_netaddr_fromin6(&netaddr, &in6a);
} }
@ -9065,7 +9065,7 @@ dns_resolver_disable_algorithm(dns_resolver_t *resolver, dns_name_t *name,
} }
memset(new, 0, len); memset(new, 0, len);
if (algorithms != NULL) if (algorithms != NULL)
memcpy(new, algorithms, *algorithms); memmove(new, algorithms, *algorithms);
new[len-1] |= mask; new[len-1] |= mask;
*new = len; *new = len;
node->data = new; node->data = new;
@ -9179,7 +9179,7 @@ dns_resolver_disable_ds_digest(dns_resolver_t *resolver, dns_name_t *name,
} }
memset(new, 0, len); memset(new, 0, len);
if (digests != NULL) if (digests != NULL)
memcpy(new, digests, *digests); memmove(new, digests, *digests);
new[len-1] |= mask; new[len-1] |= mask;
*new = len; *new = len;
node->data = new; node->data = new;

View File

@ -1431,8 +1431,8 @@ dns_rpz_beginload(dns_rpz_zones_t **load_rpzsp,
load_rpzs = *load_rpzsp; load_rpzs = *load_rpzsp;
load_rpzs->p.num_zones = rpzs->p.num_zones; load_rpzs->p.num_zones = rpzs->p.num_zones;
load_rpzs->total_triggers = rpzs->total_triggers; load_rpzs->total_triggers = rpzs->total_triggers;
memcpy(load_rpzs->triggers, rpzs->triggers, memmove(load_rpzs->triggers, rpzs->triggers,
sizeof(load_rpzs->triggers)); sizeof(load_rpzs->triggers));
memset(&load_rpzs->triggers[rpz_num], 0, memset(&load_rpzs->triggers[rpz_num], 0,
sizeof(load_rpzs->triggers[rpz_num])); sizeof(load_rpzs->triggers[rpz_num]));
load_rpzs->zones[rpz_num] = rpz; load_rpzs->zones[rpz_num] = rpz;
@ -1457,7 +1457,7 @@ fix_triggers(dns_rpz_zones_t *rpzs, dns_rpz_num_t rpz_num) {
rpzs->have.type |= zbit; \ rpzs->have.type |= zbit; \
} }
memcpy(&old_totals, &rpzs->total_triggers, sizeof(old_totals)); memmove(&old_totals, &rpzs->total_triggers, sizeof(old_totals));
memset(&rpzs->total_triggers, 0, sizeof(rpzs->total_triggers)); memset(&rpzs->total_triggers, 0, sizeof(rpzs->total_triggers));
for (n = 0; n < rpzs->p.num_zones; ++n) { for (n = 0; n < rpzs->p.num_zones; ++n) {
zbit = DNS_RPZ_ZBIT(n); zbit = DNS_RPZ_ZBIT(n);
@ -1946,7 +1946,7 @@ dns_rpz_find_ip(dns_rpz_zones_t *rpzs, dns_rpz_type_t rpz_type,
* one could cast netaddr->type.in6 to dns_rpz_cidr_key_t *, * one could cast netaddr->type.in6 to dns_rpz_cidr_key_t *,
* but some people object. * but some people object.
*/ */
memcpy(src_ip6.w, &netaddr->type.in6, sizeof(src_ip6.w)); memmove(src_ip6.w, &netaddr->type.in6, sizeof(src_ip6.w));
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
tgt_ip.w[i] = ntohl(src_ip6.w[i]); tgt_ip.w[i] = ntohl(src_ip6.w[i]);
} }

View File

@ -439,8 +439,8 @@ make_key(const dns_rrl_t *rrl, dns_rrl_key_t *key,
break; break;
case AF_INET6: case AF_INET6:
key->s.ipv6 = ISC_TRUE; key->s.ipv6 = ISC_TRUE;
memcpy(key->s.ip, &client_addr->type.sin6.sin6_addr, memmove(key->s.ip, &client_addr->type.sin6.sin6_addr,
sizeof(key->s.ip)); sizeof(key->s.ip));
for (i = 0; i < DNS_RRL_MAX_PREFIX/32; ++i) for (i = 0; i < DNS_RRL_MAX_PREFIX/32; ++i)
key->s.ip[i] &= rrl->ipv6_mask[i]; key->s.ip[i] &= rrl->ipv6_mask[i];
break; break;
@ -776,7 +776,7 @@ add_log_str(isc_buffer_t *lb, const char *str, unsigned int str_len) {
return; return;
str_len = region.length; str_len = region.length;
} }
memcpy(region.base, str, str_len); memmove(region.base, str, str_len);
isc_buffer_add(lb, str_len); isc_buffer_add(lb, str_len);
} }
@ -863,7 +863,7 @@ make_log_buf(dns_rrl_t *rrl, dns_rrl_entry_t *e,
snprintf(strbuf, sizeof(strbuf), "/%d", rrl->ipv6_prefixlen); snprintf(strbuf, sizeof(strbuf), "/%d", rrl->ipv6_prefixlen);
cidr.family = AF_INET6; cidr.family = AF_INET6;
memset(&cidr.type.in6, 0, sizeof(cidr.type.in6)); memset(&cidr.type.in6, 0, sizeof(cidr.type.in6));
memcpy(&cidr.type.in6, e->key.s.ip, sizeof(e->key.s.ip)); memmove(&cidr.type.in6, e->key.s.ip, sizeof(e->key.s.ip));
} else { } else {
snprintf(strbuf, sizeof(strbuf), "/%d", rrl->ipv4_prefixlen); snprintf(strbuf, sizeof(strbuf), "/%d", rrl->ipv4_prefixlen);
cidr.family = AF_INET; cidr.family = AF_INET;

View File

@ -463,7 +463,7 @@ code_NegTokenArg(OM_uint32 * minor_status,
free(buf); free(buf);
return (GSS_S_FAILURE); return (GSS_S_FAILURE);
} }
memcpy(*outbuf, buf + buf_size - buf_len, buf_len); memmove(*outbuf, buf + buf_size - buf_len, buf_len);
*outbuf_size = buf_len; *outbuf_size = buf_len;
free(buf); free(buf);
@ -856,7 +856,7 @@ der_get_octet_string(const unsigned char *p, size_t len,
data->data = malloc(len); data->data = malloc(len);
if (data->data == NULL) if (data->data == NULL)
return (ENOMEM); return (ENOMEM);
memcpy(data->data, p, len); memmove(data->data, p, len);
} else } else
data->data = NULL; data->data = NULL;
if (size) if (size)
@ -1217,7 +1217,7 @@ der_put_octet_string(unsigned char *p, size_t len,
p -= data->length; p -= data->length;
len -= data->length; len -= data->length;
POST(len); POST(len);
memcpy(p + 1, data->data, data->length); memmove(p + 1, data->data, data->length);
*size = data->length; *size = data->length;
return (0); return (0);
} }
@ -1397,7 +1397,7 @@ gssapi_mech_make_header(u_char *p,
p += len_len; p += len_len;
*p++ = 0x06; *p++ = 0x06;
*p++ = mech->length; *p++ = mech->length;
memcpy(p, mech->elements, mech->length); memmove(p, mech->elements, mech->length);
p += mech->length; p += mech->length;
return (p); return (p);
} }
@ -1430,7 +1430,7 @@ gssapi_spnego_encapsulate(OM_uint32 * minor_status,
gss_release_buffer(minor_status, output_token); gss_release_buffer(minor_status, output_token);
return (GSS_S_FAILURE); return (GSS_S_FAILURE);
} }
memcpy(p, buf, buf_size); memmove(p, buf, buf_size);
return (GSS_S_COMPLETE); return (GSS_S_COMPLETE);
} }

View File

@ -217,7 +217,7 @@ dns_ssutable_addrule(dns_ssutable_t *table, isc_boolean_t grant,
result = ISC_R_NOMEMORY; result = ISC_R_NOMEMORY;
goto failure; goto failure;
} }
memcpy(rule->types, types, ntypes * sizeof(dns_rdatatype_t)); memmove(rule->types, types, ntypes * sizeof(dns_rdatatype_t));
} else } else
rule->types = NULL; rule->types = NULL;

View File

@ -205,7 +205,7 @@ add_test_data(isc_mem_t *mctx, dns_rbt_t *rbt) {
dns_compress_init(&cctx, -1, mctx); dns_compress_init(&cctx, -1, mctx);
while (testdatap->name != NULL && testdatap->data.data != NULL) { while (testdatap->name != NULL && testdatap->data.data != NULL) {
memcpy(buffer, testdatap->name, testdatap->name_len); memmove(buffer, testdatap->name, testdatap->name_len);
isc_buffer_init(&b, buffer, testdatap->name_len); isc_buffer_init(&b, buffer, testdatap->name_len);
isc_buffer_add(&b, testdatap->name_len); isc_buffer_add(&b, testdatap->name_len);
@ -247,7 +247,7 @@ check_test_data(dns_rbt_t *rbt) {
foundname = dns_fixedname_name(&fixed); foundname = dns_fixedname_name(&fixed);
while (testdatap->name != NULL && testdatap->data.data != NULL) { while (testdatap->name != NULL && testdatap->data.data != NULL) {
memcpy(buffer, testdatap->name, testdatap->name_len + 1); memmove(buffer, testdatap->name, testdatap->name_len + 1);
arg = buffer; arg = buffer;
isc_buffer_init(&b, arg, testdatap->name_len); isc_buffer_init(&b, arg, testdatap->name_len);

View File

@ -98,7 +98,7 @@ dns_time64_totext(isc_int64_t t, isc_buffer_t *target) {
if (l > region.length) if (l > region.length)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(region.base, buf, l); memmove(region.base, buf, l);
isc_buffer_add(target, l); isc_buffer_add(target, l);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }

View File

@ -152,7 +152,7 @@ add_rdata_to_list(dns_message_t *msg, dns_name_t *name, dns_rdata_t *rdata,
dns_rdata_toregion(rdata, &r); dns_rdata_toregion(rdata, &r);
RETERR(isc_buffer_allocate(msg->mctx, &tmprdatabuf, r.length)); RETERR(isc_buffer_allocate(msg->mctx, &tmprdatabuf, r.length));
isc_buffer_availableregion(tmprdatabuf, &newr); isc_buffer_availableregion(tmprdatabuf, &newr);
memcpy(newr.base, r.base, r.length); memmove(newr.base, r.base, r.length);
dns_rdata_fromregion(newrdata, rdata->rdclass, rdata->type, &newr); dns_rdata_fromregion(newrdata, rdata->rdclass, rdata->type, &newr);
dns_message_takebuffer(msg, &tmprdatabuf); dns_message_takebuffer(msg, &tmprdatabuf);
@ -252,12 +252,12 @@ compute_secret(isc_buffer_t *shared, isc_region_t *queryrandomness,
if (r.length < sizeof(digests) || r.length < r2.length) if (r.length < sizeof(digests) || r.length < r2.length)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
if (r2.length > sizeof(digests)) { if (r2.length > sizeof(digests)) {
memcpy(r.base, r2.base, r2.length); memmove(r.base, r2.base, r2.length);
for (i = 0; i < sizeof(digests); i++) for (i = 0; i < sizeof(digests); i++)
r.base[i] ^= digests[i]; r.base[i] ^= digests[i];
isc_buffer_add(secret, r2.length); isc_buffer_add(secret, r2.length);
} else { } else {
memcpy(r.base, digests, sizeof(digests)); memmove(r.base, digests, sizeof(digests));
for (i = 0; i < r2.length; i++) for (i = 0; i < r2.length; i++)
r.base[i] ^= r2.base[i]; r.base[i] ^= r2.base[i];
isc_buffer_add(secret, sizeof(digests)); isc_buffer_add(secret, sizeof(digests));
@ -534,7 +534,7 @@ process_gsstkey(dns_name_t *name, dns_rdata_tkey_t *tkeyin,
goto failure; goto failure;
} }
tkeyout->keylen = isc_buffer_usedlength(outtoken); tkeyout->keylen = isc_buffer_usedlength(outtoken);
memcpy(tkeyout->key, isc_buffer_base(outtoken), memmove(tkeyout->key, isc_buffer_base(outtoken),
isc_buffer_usedlength(outtoken)); isc_buffer_usedlength(outtoken));
isc_buffer_free(&outtoken); isc_buffer_free(&outtoken);
} else { } else {
@ -544,7 +544,7 @@ process_gsstkey(dns_name_t *name, dns_rdata_tkey_t *tkeyin,
goto failure; goto failure;
} }
tkeyout->keylen = tkeyin->keylen; tkeyout->keylen = tkeyin->keylen;
memcpy(tkeyout->key, tkeyin->key, tkeyin->keylen); memmove(tkeyout->key, tkeyin->key, tkeyin->keylen);
} }
tkeyout->error = dns_rcode_noerror; tkeyout->error = dns_rcode_noerror;

View File

@ -1370,21 +1370,21 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg,
* Extract the header. * Extract the header.
*/ */
isc_buffer_usedregion(source, &r); isc_buffer_usedregion(source, &r);
memcpy(header, r.base, DNS_MESSAGE_HEADERLEN); memmove(header, r.base, DNS_MESSAGE_HEADERLEN);
isc_region_consume(&r, DNS_MESSAGE_HEADERLEN); isc_region_consume(&r, DNS_MESSAGE_HEADERLEN);
/* /*
* Decrement the additional field counter. * Decrement the additional field counter.
*/ */
memcpy(&addcount, &header[DNS_MESSAGE_HEADERLEN - 2], 2); memmove(&addcount, &header[DNS_MESSAGE_HEADERLEN - 2], 2);
addcount = htons((isc_uint16_t)(ntohs(addcount) - 1)); addcount = htons((isc_uint16_t)(ntohs(addcount) - 1));
memcpy(&header[DNS_MESSAGE_HEADERLEN - 2], &addcount, 2); memmove(&header[DNS_MESSAGE_HEADERLEN - 2], &addcount, 2);
/* /*
* Put in the original id. * Put in the original id.
*/ */
id = htons(tsig.originalid); id = htons(tsig.originalid);
memcpy(&header[0], &id, 2); memmove(&header[0], &id, 2);
/* /*
* Digest the modified header. * Digest the modified header.
@ -1609,16 +1609,16 @@ tsig_verify_tcp(isc_buffer_t *source, dns_message_t *msg) {
* Extract the header. * Extract the header.
*/ */
isc_buffer_usedregion(source, &r); isc_buffer_usedregion(source, &r);
memcpy(header, r.base, DNS_MESSAGE_HEADERLEN); memmove(header, r.base, DNS_MESSAGE_HEADERLEN);
isc_region_consume(&r, DNS_MESSAGE_HEADERLEN); isc_region_consume(&r, DNS_MESSAGE_HEADERLEN);
/* /*
* Decrement the additional field counter if necessary. * Decrement the additional field counter if necessary.
*/ */
if (has_tsig) { if (has_tsig) {
memcpy(&addcount, &header[DNS_MESSAGE_HEADERLEN - 2], 2); memmove(&addcount, &header[DNS_MESSAGE_HEADERLEN - 2], 2);
addcount = htons((isc_uint16_t)(ntohs(addcount) - 1)); addcount = htons((isc_uint16_t)(ntohs(addcount) - 1));
memcpy(&header[DNS_MESSAGE_HEADERLEN - 2], &addcount, 2); memmove(&header[DNS_MESSAGE_HEADERLEN - 2], &addcount, 2);
} }
/* /*
@ -1627,7 +1627,7 @@ tsig_verify_tcp(isc_buffer_t *source, dns_message_t *msg) {
/* XXX Can TCP transfers be forwarded? How would that work? */ /* XXX Can TCP transfers be forwarded? How would that work? */
if (has_tsig) { if (has_tsig) {
id = htons(tsig.originalid); id = htons(tsig.originalid);
memcpy(&header[0], &id, 2); memmove(&header[0], &id, 2);
} }
/* /*

View File

@ -68,7 +68,7 @@ ttlfmt(unsigned int t, const char *s, isc_boolean_t verbose,
isc_buffer_availableregion(target, &region); isc_buffer_availableregion(target, &region);
if (len > region.length) if (len > region.length)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(region.base, tmp, len); memmove(region.base, tmp, len);
isc_buffer_add(target, len); isc_buffer_add(target, len);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);

View File

@ -2709,7 +2709,7 @@ isspf(const dns_rdata_t *rdata) {
INSIST(tl <= rdl); INSIST(tl <= rdl);
if (len > sizeof(buf) - i - 1) if (len > sizeof(buf) - i - 1)
len = sizeof(buf) - i - 1; len = sizeof(buf) - i - 1;
memcpy(buf + i, data, len); memmove(buf + i, data, len);
i += len; i += len;
data += tl; data += tl;
rdl -= tl; rdl -= tl;
@ -3066,7 +3066,7 @@ zone_addnsec3chain(dns_zone_t *zone, dns_rdata_nsec3param_t *nsec3param) {
nsec3chain->nsec3param.iterations = nsec3param->iterations; nsec3chain->nsec3param.iterations = nsec3param->iterations;
nsec3chain->nsec3param.flags = nsec3param->flags; nsec3chain->nsec3param.flags = nsec3param->flags;
nsec3chain->nsec3param.salt_length = nsec3param->salt_length; nsec3chain->nsec3param.salt_length = nsec3param->salt_length;
memcpy(nsec3chain->salt, nsec3param->salt, nsec3param->salt_length); memmove(nsec3chain->salt, nsec3param->salt, nsec3param->salt_length);
nsec3chain->nsec3param.salt = nsec3chain->salt; nsec3chain->nsec3param.salt = nsec3chain->salt;
nsec3chain->seen_nsec = ISC_FALSE; nsec3chain->seen_nsec = ISC_FALSE;
nsec3chain->delete_nsec = ISC_FALSE; nsec3chain->delete_nsec = ISC_FALSE;
@ -5311,7 +5311,7 @@ set_addrkeylist(unsigned int count,
newaddrs = isc_mem_get(mctx, count * sizeof(*newaddrs)); newaddrs = isc_mem_get(mctx, count * sizeof(*newaddrs));
if (newaddrs == NULL) if (newaddrs == NULL)
return (ISC_R_NOMEMORY); return (ISC_R_NOMEMORY);
memcpy(newaddrs, addrs, count * sizeof(*newaddrs)); memmove(newaddrs, addrs, count * sizeof(*newaddrs));
if (dscp != NULL) { if (dscp != NULL) {
newdscp = isc_mem_get(mctx, count * sizeof(*newdscp)); newdscp = isc_mem_get(mctx, count * sizeof(*newdscp));
@ -5319,7 +5319,7 @@ set_addrkeylist(unsigned int count,
isc_mem_put(mctx, newaddrs, count * sizeof(*newaddrs)); isc_mem_put(mctx, newaddrs, count * sizeof(*newaddrs));
return (ISC_R_NOMEMORY); return (ISC_R_NOMEMORY);
} }
memcpy(newdscp, dscp, count * sizeof(*newdscp)); memmove(newdscp, dscp, count * sizeof(*newdscp));
} else } else
newdscp = NULL; newdscp = NULL;

View File

@ -409,7 +409,7 @@ getaddrinfo(const char *hostname, const char *servname,
* Convert to a V4 mapped address. * Convert to a V4 mapped address.
*/ */
struct in6_addr *a6 = (struct in6_addr *)abuf; struct in6_addr *a6 = (struct in6_addr *)abuf;
memcpy(&a6->s6_addr[12], &a6->s6_addr[0], 4); memmove(&a6->s6_addr[12], &a6->s6_addr[0], 4);
memset(&a6->s6_addr[10], 0xff, 2); memset(&a6->s6_addr[10], 0xff, 2);
memset(&a6->s6_addr[0], 0, 10); memset(&a6->s6_addr[0], 0, 10);
goto inet6_addr; goto inet6_addr;
@ -446,7 +446,7 @@ getaddrinfo(const char *hostname, const char *servname,
ai_list = ai; ai_list = ai;
ai->ai_socktype = socktype; ai->ai_socktype = socktype;
SIN(ai->ai_addr)->sin_port = port; SIN(ai->ai_addr)->sin_port = port;
memcpy((char *)ai->ai_addr + addroff, abuf, addrsize); memmove((char *)ai->ai_addr + addroff, abuf, addrsize);
if ((flags & AI_CANONNAME) != 0) { if ((flags & AI_CANONNAME) != 0) {
#ifdef IRS_HAVE_SIN6_SCOPE_ID #ifdef IRS_HAVE_SIN6_SCOPE_ID
if (ai->ai_family == AF_INET6) if (ai->ai_family == AF_INET6)
@ -789,8 +789,8 @@ process_answer(isc_task_t *task, isc_event_t *event) {
RUNTIME_CHECK(result == ISC_R_SUCCESS); RUNTIME_CHECK(result == ISC_R_SUCCESS);
SIN(ai->ai_addr)->sin_port = SIN(ai->ai_addr)->sin_port =
resstate->head->ai_port; resstate->head->ai_port;
memcpy(&SIN(ai->ai_addr)->sin_addr, memmove(&SIN(ai->ai_addr)->sin_addr,
&rdata_a.in_addr, 4); &rdata_a.in_addr, 4);
dns_rdata_freestruct(&rdata_a); dns_rdata_freestruct(&rdata_a);
break; break;
case AF_INET6: case AF_INET6:
@ -800,8 +800,8 @@ process_answer(isc_task_t *task, isc_event_t *event) {
RUNTIME_CHECK(result == ISC_R_SUCCESS); RUNTIME_CHECK(result == ISC_R_SUCCESS);
SIN6(ai->ai_addr)->sin6_port = SIN6(ai->ai_addr)->sin6_port =
resstate->head->ai_port; resstate->head->ai_port;
memcpy(&SIN6(ai->ai_addr)->sin6_addr, memmove(&SIN6(ai->ai_addr)->sin6_addr,
&rdata_aaaa.in6_addr, 16); &rdata_aaaa.in6_addr, 16);
dns_rdata_freestruct(&rdata_aaaa); dns_rdata_freestruct(&rdata_aaaa);
break; break;
} }
@ -1130,7 +1130,7 @@ add_ipv4(const char *hostname, int flags, struct addrinfo **aip,
*aip = ai; *aip = ai;
ai->ai_socktype = socktype; ai->ai_socktype = socktype;
SIN(ai->ai_addr)->sin_port = port; SIN(ai->ai_addr)->sin_port = port;
memcpy(&SIN(ai->ai_addr)->sin_addr, v4_loop, 4); memmove(&SIN(ai->ai_addr)->sin_addr, v4_loop, 4);
return (0); return (0);
} }
@ -1153,7 +1153,7 @@ add_ipv6(const char *hostname, int flags, struct addrinfo **aip,
*aip = ai; *aip = ai;
ai->ai_socktype = socktype; ai->ai_socktype = socktype;
SIN6(ai->ai_addr)->sin6_port = port; SIN6(ai->ai_addr)->sin6_port = port;
memcpy(&SIN6(ai->ai_addr)->sin6_addr, v6_loop, 16); memmove(&SIN6(ai->ai_addr)->sin6_addr, v6_loop, 16);
return (0); return (0);
} }

View File

@ -224,7 +224,7 @@ add_server(isc_mem_t *mctx, const char *address_str,
v4 = &((struct sockaddr_in *)res->ai_addr)->sin_addr; v4 = &((struct sockaddr_in *)res->ai_addr)->sin_addr;
if (memcmp(v4, zeroaddress, 4) == 0) if (memcmp(v4, zeroaddress, 4) == 0)
memcpy(v4, loopaddress, 4); memmove(v4, loopaddress, 4);
} }
address = isc_mem_get(mctx, sizeof(*address)); address = isc_mem_get(mctx, sizeof(*address));
@ -238,7 +238,7 @@ add_server(isc_mem_t *mctx, const char *address_str,
goto cleanup; goto cleanup;
} }
address->length = res->ai_addrlen; address->length = res->ai_addrlen;
memcpy(&address->type.ss, res->ai_addr, res->ai_addrlen); memmove(&address->type.ss, res->ai_addr, res->ai_addrlen);
ISC_LINK_INIT(address, link); ISC_LINK_INIT(address, link);
ISC_LIST_APPEND(*nameservers, address, link); ISC_LIST_APPEND(*nameservers, address, link);
@ -258,14 +258,14 @@ create_addr(const char *buffer, isc_netaddr_t *addr, int convert_zero) {
unsigned char zeroaddress[] = {0, 0, 0, 0}; unsigned char zeroaddress[] = {0, 0, 0, 0};
unsigned char loopaddress[] = {127, 0, 0, 1}; unsigned char loopaddress[] = {127, 0, 0, 1};
if (memcmp(&v4, zeroaddress, 4) == 0) if (memcmp(&v4, zeroaddress, 4) == 0)
memcpy(&v4, loopaddress, 4); memmove(&v4, loopaddress, 4);
} }
addr->family = AF_INET; addr->family = AF_INET;
memcpy(&addr->type.in, &v4, NS_INADDRSZ); memmove(&addr->type.in, &v4, NS_INADDRSZ);
addr->zone = 0; addr->zone = 0;
} else if (inet_pton(AF_INET6, buffer, &v6) == 1) { } else if (inet_pton(AF_INET6, buffer, &v6) == 1) {
addr->family = AF_INET6; addr->family = AF_INET6;
memcpy(&addr->type.in6, &v6, NS_IN6ADDRSZ); memmove(&addr->type.in6, &v6, NS_IN6ADDRSZ);
addr->zone = 0; addr->zone = 0;
} else } else
return (ISC_R_BADADDRESSFORM); /* Unrecognised format. */ return (ISC_R_BADADDRESSFORM); /* Unrecognised format. */

View File

@ -355,7 +355,7 @@ str_totext(const char *source, isc_buffer_t *target) {
if (l > region.length) if (l > region.length)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(region.base, source, l); memmove(region.base, source, l);
isc_buffer_add(target, l); isc_buffer_add(target, l);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
@ -367,7 +367,7 @@ mem_tobuffer(isc_buffer_t *target, void *base, unsigned int length) {
isc_buffer_availableregion(target, &tr); isc_buffer_availableregion(target, &tr);
if (length > tr.length) if (length > tr.length)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(tr.base, base, length); memmove(tr.base, base, length);
isc_buffer_add(target, length); isc_buffer_add(target, length);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }

View File

@ -234,7 +234,7 @@ str_totext(const char *source, isc_buffer_t *target) {
if (l > region.length) if (l > region.length)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(region.base, source, l); memmove(region.base, source, l);
isc_buffer_add(target, l); isc_buffer_add(target, l);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
@ -246,7 +246,7 @@ mem_tobuffer(isc_buffer_t *target, void *base, unsigned int length) {
isc_buffer_availableregion(target, &tr); isc_buffer_availableregion(target, &tr);
if (length > tr.length) if (length > tr.length)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(tr.base, base, length); memmove(tr.base, base, length);
isc_buffer_add(target, length); isc_buffer_add(target, length);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }

View File

@ -420,7 +420,7 @@ isc__buffer_putstr(isc_buffer_t *b, const char *source) {
REQUIRE(l <= isc_buffer_availablelength(b)); REQUIRE(l <= isc_buffer_availablelength(b));
cp = isc_buffer_used(b); cp = isc_buffer_used(b);
memcpy(cp, source, l); memmove(cp, source, l);
b->used += l; b->used += l;
} }
@ -439,7 +439,7 @@ isc_buffer_copyregion(isc_buffer_t *b, const isc_region_t *r) {
available = isc_buffer_availablelength(b); available = isc_buffer_availablelength(b);
if (r->length > available) if (r->length > available)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(base, r->base, r->length); memmove(base, r->base, r->length);
b->used += r->length; b->used += r->length;
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);

View File

@ -262,7 +262,7 @@ isc_hash_ctxinit(isc_hash_t *hctx) {
else else
copylen = hctx->vectorlen - i; copylen = hctx->vectorlen - i;
memcpy(p, &pr, copylen); memmove(p, &pr, copylen);
} }
INSIST(p == (unsigned char *)hctx->rndvector + INSIST(p == (unsigned char *)hctx->rndvector +
hctx->vectorlen); hctx->vectorlen);
@ -314,9 +314,9 @@ destroy(isc_hash_t **hctxp) {
DESTROYLOCK(&hctx->lock); DESTROYLOCK(&hctx->lock);
memcpy(canary0, hctx + 1, sizeof(canary0)); memmove(canary0, hctx + 1, sizeof(canary0));
memset(hctx, 0, sizeof(isc_hash_t)); memset(hctx, 0, sizeof(isc_hash_t));
memcpy(canary1, hctx + 1, sizeof(canary1)); memmove(canary1, hctx + 1, sizeof(canary1));
INSIST(memcmp(canary0, canary1, sizeof(canary0)) == 0); INSIST(memcmp(canary0, canary1, sizeof(canary0)) == 0);
isc_mem_put(mctx, hctx, sizeof(isc_hash_t)); isc_mem_put(mctx, hctx, sizeof(isc_hash_t));
isc_mem_detach(&mctx); isc_mem_detach(&mctx);

View File

@ -32,7 +32,7 @@
#include <isc/heap.h> #include <isc/heap.h>
#include <isc/magic.h> #include <isc/magic.h>
#include <isc/mem.h> #include <isc/mem.h>
#include <isc/string.h> /* Required for memcpy. */ #include <isc/string.h> /* Required for memmove. */
#include <isc/util.h> #include <isc/util.h>
/*@{*/ /*@{*/
@ -132,7 +132,7 @@ resize(isc_heap_t *heap) {
if (new_array == NULL) if (new_array == NULL)
return (ISC_FALSE); return (ISC_FALSE);
if (heap->array != NULL) { if (heap->array != NULL) {
memcpy(new_array, heap->array, heap->size * sizeof(void *)); memmove(new_array, heap->array, heap->size * sizeof(void *));
isc_mem_put(heap->mctx, heap->array, isc_mem_put(heap->mctx, heap->array,
heap->size * sizeof(void *)); heap->size * sizeof(void *));
} }

View File

@ -183,7 +183,7 @@ str_totext(const char *source, isc_buffer_t *target) {
if (l > region.length) if (l > region.length)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(region.base, source, l); memmove(region.base, source, l);
isc_buffer_add(target, l); isc_buffer_add(target, l);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
@ -195,7 +195,7 @@ mem_tobuffer(isc_buffer_t *target, void *base, unsigned int length) {
isc_buffer_availableregion(target, &tr); isc_buffer_availableregion(target, &tr);
if (length > tr.length) if (length > tr.length)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
memcpy(tr.base, base, length); memmove(tr.base, base, length);
isc_buffer_add(target, length); isc_buffer_add(target, length);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }

View File

@ -83,7 +83,7 @@ isc_hmacmd5_init(isc_hmacmd5_t *ctx, const unsigned char *key,
isc_md5_update(&md5ctx, key, len); isc_md5_update(&md5ctx, key, len);
isc_md5_final(&md5ctx, ctx->key); isc_md5_final(&md5ctx, ctx->key);
} else } else
memcpy(ctx->key, key, len); memmove(ctx->key, key, len);
isc_md5_init(&ctx->md5ctx); isc_md5_init(&ctx->md5ctx);
memset(ipad, IPAD, sizeof(ipad)); memset(ipad, IPAD, sizeof(ipad));

View File

@ -63,7 +63,7 @@ isc_hmacsha1_sign(isc_hmacsha1_t *ctx, unsigned char *digest, size_t len) {
HMAC_Final(ctx, newdigest, NULL); HMAC_Final(ctx, newdigest, NULL);
HMAC_CTX_cleanup(ctx); HMAC_CTX_cleanup(ctx);
memcpy(digest, newdigest, len); memmove(digest, newdigest, len);
memset(newdigest, 0, sizeof(newdigest)); memset(newdigest, 0, sizeof(newdigest));
} }
@ -94,7 +94,7 @@ isc_hmacsha224_sign(isc_hmacsha224_t *ctx, unsigned char *digest, size_t len) {
HMAC_Final(ctx, newdigest, NULL); HMAC_Final(ctx, newdigest, NULL);
HMAC_CTX_cleanup(ctx); HMAC_CTX_cleanup(ctx);
memcpy(digest, newdigest, len); memmove(digest, newdigest, len);
memset(newdigest, 0, sizeof(newdigest)); memset(newdigest, 0, sizeof(newdigest));
} }
@ -125,7 +125,7 @@ isc_hmacsha256_sign(isc_hmacsha256_t *ctx, unsigned char *digest, size_t len) {
HMAC_Final(ctx, newdigest, NULL); HMAC_Final(ctx, newdigest, NULL);
HMAC_CTX_cleanup(ctx); HMAC_CTX_cleanup(ctx);
memcpy(digest, newdigest, len); memmove(digest, newdigest, len);
memset(newdigest, 0, sizeof(newdigest)); memset(newdigest, 0, sizeof(newdigest));
} }
@ -156,7 +156,7 @@ isc_hmacsha384_sign(isc_hmacsha384_t *ctx, unsigned char *digest, size_t len) {
HMAC_Final(ctx, newdigest, NULL); HMAC_Final(ctx, newdigest, NULL);
HMAC_CTX_cleanup(ctx); HMAC_CTX_cleanup(ctx);
memcpy(digest, newdigest, len); memmove(digest, newdigest, len);
memset(newdigest, 0, sizeof(newdigest)); memset(newdigest, 0, sizeof(newdigest));
} }
@ -187,7 +187,7 @@ isc_hmacsha512_sign(isc_hmacsha512_t *ctx, unsigned char *digest, size_t len) {
HMAC_Final(ctx, newdigest, NULL); HMAC_Final(ctx, newdigest, NULL);
HMAC_CTX_cleanup(ctx); HMAC_CTX_cleanup(ctx);
memcpy(digest, newdigest, len); memmove(digest, newdigest, len);
memset(newdigest, 0, sizeof(newdigest)); memset(newdigest, 0, sizeof(newdigest));
} }
@ -213,7 +213,7 @@ isc_hmacsha1_init(isc_hmacsha1_t *ctx, const unsigned char *key,
isc_sha1_update(&sha1ctx, key, len); isc_sha1_update(&sha1ctx, key, len);
isc_sha1_final(&sha1ctx, ctx->key); isc_sha1_final(&sha1ctx, ctx->key);
} else } else
memcpy(ctx->key, key, len); memmove(ctx->key, key, len);
isc_sha1_init(&ctx->sha1ctx); isc_sha1_init(&ctx->sha1ctx);
memset(ipad, IPAD, sizeof(ipad)); memset(ipad, IPAD, sizeof(ipad));
@ -260,7 +260,7 @@ isc_hmacsha1_sign(isc_hmacsha1_t *ctx, unsigned char *digest, size_t len) {
isc_sha1_update(&ctx->sha1ctx, newdigest, ISC_SHA1_DIGESTLENGTH); isc_sha1_update(&ctx->sha1ctx, newdigest, ISC_SHA1_DIGESTLENGTH);
isc_sha1_final(&ctx->sha1ctx, newdigest); isc_sha1_final(&ctx->sha1ctx, newdigest);
isc_hmacsha1_invalidate(ctx); isc_hmacsha1_invalidate(ctx);
memcpy(digest, newdigest, len); memmove(digest, newdigest, len);
memset(newdigest, 0, sizeof(newdigest)); memset(newdigest, 0, sizeof(newdigest));
} }
@ -281,7 +281,7 @@ isc_hmacsha224_init(isc_hmacsha224_t *ctx, const unsigned char *key,
isc_sha224_update(&sha224ctx, key, len); isc_sha224_update(&sha224ctx, key, len);
isc_sha224_final(ctx->key, &sha224ctx); isc_sha224_final(ctx->key, &sha224ctx);
} else } else
memcpy(ctx->key, key, len); memmove(ctx->key, key, len);
isc_sha224_init(&ctx->sha224ctx); isc_sha224_init(&ctx->sha224ctx);
memset(ipad, IPAD, sizeof(ipad)); memset(ipad, IPAD, sizeof(ipad));
@ -326,7 +326,7 @@ isc_hmacsha224_sign(isc_hmacsha224_t *ctx, unsigned char *digest, size_t len) {
isc_sha224_update(&ctx->sha224ctx, opad, sizeof(opad)); isc_sha224_update(&ctx->sha224ctx, opad, sizeof(opad));
isc_sha224_update(&ctx->sha224ctx, newdigest, ISC_SHA224_DIGESTLENGTH); isc_sha224_update(&ctx->sha224ctx, newdigest, ISC_SHA224_DIGESTLENGTH);
isc_sha224_final(newdigest, &ctx->sha224ctx); isc_sha224_final(newdigest, &ctx->sha224ctx);
memcpy(digest, newdigest, len); memmove(digest, newdigest, len);
memset(newdigest, 0, sizeof(newdigest)); memset(newdigest, 0, sizeof(newdigest));
} }
@ -347,7 +347,7 @@ isc_hmacsha256_init(isc_hmacsha256_t *ctx, const unsigned char *key,
isc_sha256_update(&sha256ctx, key, len); isc_sha256_update(&sha256ctx, key, len);
isc_sha256_final(ctx->key, &sha256ctx); isc_sha256_final(ctx->key, &sha256ctx);
} else } else
memcpy(ctx->key, key, len); memmove(ctx->key, key, len);
isc_sha256_init(&ctx->sha256ctx); isc_sha256_init(&ctx->sha256ctx);
memset(ipad, IPAD, sizeof(ipad)); memset(ipad, IPAD, sizeof(ipad));
@ -392,7 +392,7 @@ isc_hmacsha256_sign(isc_hmacsha256_t *ctx, unsigned char *digest, size_t len) {
isc_sha256_update(&ctx->sha256ctx, opad, sizeof(opad)); isc_sha256_update(&ctx->sha256ctx, opad, sizeof(opad));
isc_sha256_update(&ctx->sha256ctx, newdigest, ISC_SHA256_DIGESTLENGTH); isc_sha256_update(&ctx->sha256ctx, newdigest, ISC_SHA256_DIGESTLENGTH);
isc_sha256_final(newdigest, &ctx->sha256ctx); isc_sha256_final(newdigest, &ctx->sha256ctx);
memcpy(digest, newdigest, len); memmove(digest, newdigest, len);
memset(newdigest, 0, sizeof(newdigest)); memset(newdigest, 0, sizeof(newdigest));
} }
@ -413,7 +413,7 @@ isc_hmacsha384_init(isc_hmacsha384_t *ctx, const unsigned char *key,
isc_sha384_update(&sha384ctx, key, len); isc_sha384_update(&sha384ctx, key, len);
isc_sha384_final(ctx->key, &sha384ctx); isc_sha384_final(ctx->key, &sha384ctx);
} else } else
memcpy(ctx->key, key, len); memmove(ctx->key, key, len);
isc_sha384_init(&ctx->sha384ctx); isc_sha384_init(&ctx->sha384ctx);
memset(ipad, IPAD, sizeof(ipad)); memset(ipad, IPAD, sizeof(ipad));
@ -458,7 +458,7 @@ isc_hmacsha384_sign(isc_hmacsha384_t *ctx, unsigned char *digest, size_t len) {
isc_sha384_update(&ctx->sha384ctx, opad, sizeof(opad)); isc_sha384_update(&ctx->sha384ctx, opad, sizeof(opad));
isc_sha384_update(&ctx->sha384ctx, newdigest, ISC_SHA384_DIGESTLENGTH); isc_sha384_update(&ctx->sha384ctx, newdigest, ISC_SHA384_DIGESTLENGTH);
isc_sha384_final(newdigest, &ctx->sha384ctx); isc_sha384_final(newdigest, &ctx->sha384ctx);
memcpy(digest, newdigest, len); memmove(digest, newdigest, len);
memset(newdigest, 0, sizeof(newdigest)); memset(newdigest, 0, sizeof(newdigest));
} }
@ -479,7 +479,7 @@ isc_hmacsha512_init(isc_hmacsha512_t *ctx, const unsigned char *key,
isc_sha512_update(&sha512ctx, key, len); isc_sha512_update(&sha512ctx, key, len);
isc_sha512_final(ctx->key, &sha512ctx); isc_sha512_final(ctx->key, &sha512ctx);
} else } else
memcpy(ctx->key, key, len); memmove(ctx->key, key, len);
isc_sha512_init(&ctx->sha512ctx); isc_sha512_init(&ctx->sha512ctx);
memset(ipad, IPAD, sizeof(ipad)); memset(ipad, IPAD, sizeof(ipad));
@ -524,7 +524,7 @@ isc_hmacsha512_sign(isc_hmacsha512_t *ctx, unsigned char *digest, size_t len) {
isc_sha512_update(&ctx->sha512ctx, opad, sizeof(opad)); isc_sha512_update(&ctx->sha512ctx, opad, sizeof(opad));
isc_sha512_update(&ctx->sha512ctx, newdigest, ISC_SHA512_DIGESTLENGTH); isc_sha512_update(&ctx->sha512ctx, newdigest, ISC_SHA512_DIGESTLENGTH);
isc_sha512_final(newdigest, &ctx->sha512ctx); isc_sha512_final(newdigest, &ctx->sha512ctx);
memcpy(digest, newdigest, len); memmove(digest, newdigest, len);
memset(newdigest, 0, sizeof(newdigest)); memset(newdigest, 0, sizeof(newdigest));
} }
#endif /* !ISC_PLATFORM_OPENSSLHASH */ #endif /* !ISC_PLATFORM_OPENSSLHASH */

View File

@ -787,7 +787,7 @@ ISC_LANG_ENDDECLS
#define ISC__BUFFER_PUTMEM(_b, _base, _length) \ #define ISC__BUFFER_PUTMEM(_b, _base, _length) \
do { \ do { \
memcpy(isc_buffer_used(_b), (_base), (_length)); \ memmove(isc_buffer_used(_b), (_base), (_length)); \
(_b)->used += (_length); \ (_b)->used += (_length); \
} while (0) } while (0)
@ -797,7 +797,7 @@ ISC_LANG_ENDDECLS
unsigned char *_cp; \ unsigned char *_cp; \
_length = strlen(_source); \ _length = strlen(_source); \
_cp = isc_buffer_used(_b); \ _cp = isc_buffer_used(_b); \
memcpy(_cp, (_source), _length); \ memmove(_cp, (_source), _length); \
(_b)->used += (_length); \ (_b)->used += (_length); \
} while (0) } while (0)

View File

@ -41,10 +41,10 @@
(pt).family = (na)->family; \ (pt).family = (na)->family; \
(pt).bitlen = (bits); \ (pt).bitlen = (bits); \
if ((pt).family == AF_INET6) { \ if ((pt).family == AF_INET6) { \
memcpy(&(pt).add.sin6, &(na)->type.in6, \ memmove(&(pt).add.sin6, &(na)->type.in6, \
((bits)+7)/8); \ ((bits)+7)/8); \
} else \ } else \
memcpy(&(pt).add.sin, &(na)->type.in, \ memmove(&(pt).add.sin, &(na)->type.in, \
((bits)+7)/8); \ ((bits)+7)/8); \
} else { \ } else { \
(pt).family = AF_UNSPEC; \ (pt).family = AF_UNSPEC; \

View File

@ -114,7 +114,7 @@ inet_pton4(const char *src, unsigned char *dst) {
} }
if (octets < 4) if (octets < 4)
return (0); return (0);
memcpy(dst, tmp, NS_INADDRSZ); memmove(dst, tmp, NS_INADDRSZ);
return (1); return (1);
} }
@ -210,6 +210,6 @@ inet_pton6(const char *src, unsigned char *dst) {
} }
if (tp != endp) if (tp != endp)
return (0); return (0);
memcpy(dst, tmp, NS_IN6ADDRSZ); memmove(dst, tmp, NS_IN6ADDRSZ);
return (1); return (1);
} }

View File

@ -75,7 +75,7 @@ grow_data(isc_lex_t *lex, size_t *remainingp, char **currp, char **prevp) {
new = isc_mem_get(lex->mctx, lex->max_token * 2 + 1); new = isc_mem_get(lex->mctx, lex->max_token * 2 + 1);
if (new == NULL) if (new == NULL)
return (ISC_R_NOMEMORY); return (ISC_R_NOMEMORY);
memcpy(new, lex->data, lex->max_token + 1); memmove(new, lex->data, lex->max_token + 1);
*currp = new + (*currp - lex->data); *currp = new + (*currp - lex->data);
if (*prevp != NULL) if (*prevp != NULL)
*prevp = new + (*prevp - lex->data); *prevp = new + (*prevp - lex->data);
@ -173,7 +173,7 @@ isc_lex_getspecials(isc_lex_t *lex, isc_lexspecials_t specials) {
REQUIRE(VALID_LEX(lex)); REQUIRE(VALID_LEX(lex));
memcpy(specials, lex->specials, 256); memmove(specials, lex->specials, 256);
} }
void void
@ -185,7 +185,7 @@ isc_lex_setspecials(isc_lex_t *lex, isc_lexspecials_t specials) {
REQUIRE(VALID_LEX(lex)); REQUIRE(VALID_LEX(lex));
memcpy(lex->specials, specials, 256); memmove(lex->specials, specials, 256);
} }
static inline isc_result_t static inline isc_result_t

View File

@ -1130,7 +1130,7 @@ sync_channellist(isc_logconfig_t *lcfg) {
if (lcfg->channellist_count != 0) { if (lcfg->channellist_count != 0) {
bytes = lcfg->channellist_count * bytes = lcfg->channellist_count *
sizeof(ISC_LIST(isc_logchannellist_t)); sizeof(ISC_LIST(isc_logchannellist_t));
memcpy(lists, lcfg->channellists, bytes); memmove(lists, lcfg->channellists, bytes);
isc_mem_put(lctx->mctx, lcfg->channellists, bytes); isc_mem_put(lctx->mctx, lcfg->channellists, bytes);
} }

View File

@ -217,11 +217,11 @@ isc_md5_update(isc_md5_t *ctx, const unsigned char *buf, unsigned int len) {
t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */ t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */
if (t > len) { if (t > len) {
memcpy((unsigned char *)ctx->in + 64 - t, buf, len); memmove((unsigned char *)ctx->in + 64 - t, buf, len);
return; return;
} }
/* First chunk is an odd size */ /* First chunk is an odd size */
memcpy((unsigned char *)ctx->in + 64 - t, buf, t); memmove((unsigned char *)ctx->in + 64 - t, buf, t);
byteSwap(ctx->in, 16); byteSwap(ctx->in, 16);
transform(ctx->buf, ctx->in); transform(ctx->buf, ctx->in);
buf += t; buf += t;
@ -229,7 +229,7 @@ isc_md5_update(isc_md5_t *ctx, const unsigned char *buf, unsigned int len) {
/* Process data in 64-byte chunks */ /* Process data in 64-byte chunks */
while (len >= 64) { while (len >= 64) {
memcpy(ctx->in, buf, 64); memmove(ctx->in, buf, 64);
byteSwap(ctx->in, 16); byteSwap(ctx->in, 16);
transform(ctx->buf, ctx->in); transform(ctx->buf, ctx->in);
buf += 64; buf += 64;
@ -237,7 +237,7 @@ isc_md5_update(isc_md5_t *ctx, const unsigned char *buf, unsigned int len) {
} }
/* Handle any remaining bytes of data. */ /* Handle any remaining bytes of data. */
memcpy(ctx->in, buf, len); memmove(ctx->in, buf, len);
} }
/*! /*!
@ -271,7 +271,7 @@ isc_md5_final(isc_md5_t *ctx, unsigned char *digest) {
transform(ctx->buf, ctx->in); transform(ctx->buf, ctx->in);
byteSwap(ctx->buf, 4); byteSwap(ctx->buf, 4);
memcpy(digest, ctx->buf, 16); memmove(digest, ctx->buf, 16);
memset(ctx, 0, sizeof(isc_md5_t)); /* In case it's sensitive */ memset(ctx, 0, sizeof(isc_md5_t)); /* In case it's sensitive */
} }
#endif #endif

View File

@ -542,9 +542,9 @@ more_basic_blocks(isc__mem_t *ctx) {
return (ISC_FALSE); return (ISC_FALSE);
} }
if (ctx->basic_table_size != 0) { if (ctx->basic_table_size != 0) {
memcpy(table, ctx->basic_table, memmove(table, ctx->basic_table,
ctx->basic_table_size * ctx->basic_table_size *
sizeof(unsigned char *)); sizeof(unsigned char *));
(ctx->memfree)(ctx->arg, ctx->basic_table); (ctx->memfree)(ctx->arg, ctx->basic_table);
} }
ctx->basic_table = table; ctx->basic_table = table;
@ -1580,7 +1580,7 @@ isc___mem_reallocate(isc_mem_t *ctx0, void *ptr, size_t size FLARG) {
oldsize -= ALIGNMENT_SIZE; oldsize -= ALIGNMENT_SIZE;
} }
copysize = (oldsize > size) ? size : oldsize; copysize = (oldsize > size) ? size : oldsize;
memcpy(new_ptr, ptr, copysize); memmove(new_ptr, ptr, copysize);
isc__mem_free(ctx0, ptr FLARG_PASS); isc__mem_free(ctx0, ptr FLARG_PASS);
} }
} else if (ptr != NULL) } else if (ptr != NULL)

View File

@ -340,7 +340,7 @@ isc_netaddr_fromsockaddr(isc_netaddr_t *t, const isc_sockaddr_t *s) {
t->zone = 0; t->zone = 0;
break; break;
case AF_INET6: case AF_INET6:
memcpy(&t->type.in6, &s->type.sin6.sin6_addr, 16); memmove(&t->type.in6, &s->type.sin6.sin6_addr, 16);
#ifdef ISC_PLATFORM_HAVESCOPEID #ifdef ISC_PLATFORM_HAVESCOPEID
t->zone = s->type.sin6.sin6_scope_id; t->zone = s->type.sin6.sin6_scope_id;
#else #else
@ -349,7 +349,7 @@ isc_netaddr_fromsockaddr(isc_netaddr_t *t, const isc_sockaddr_t *s) {
break; break;
#ifdef ISC_PLATFORM_HAVESYSUNH #ifdef ISC_PLATFORM_HAVESYSUNH
case AF_UNIX: case AF_UNIX:
memcpy(t->type.un, s->type.sunix.sun_path, sizeof(t->type.un)); memmove(t->type.un, s->type.sunix.sun_path, sizeof(t->type.un));
t->zone = 0; t->zone = 0;
break; break;
#endif #endif
@ -429,6 +429,6 @@ isc_netaddr_fromv4mapped(isc_netaddr_t *t, const isc_netaddr_t *s) {
memset(t, 0, sizeof(*t)); memset(t, 0, sizeof(*t));
t->family = AF_INET; t->family = AF_INET;
memcpy(&t->type.in, (char *)&src->type.in6 + 12, 4); memmove(&t->type.in, (char *)&src->type.in6 + 12, 4);
return; return;
} }

View File

@ -62,11 +62,11 @@ _new_prefix(isc_mem_t *mctx, isc_prefix_t **target, int family, void *dest,
if (family == AF_INET6) { if (family == AF_INET6) {
prefix->bitlen = (bitlen >= 0) ? bitlen : 128; prefix->bitlen = (bitlen >= 0) ? bitlen : 128;
memcpy(&prefix->add.sin6, dest, 16); memmove(&prefix->add.sin6, dest, 16);
} else { } else {
/* AF_UNSPEC is "any" or "none"--treat it as AF_INET */ /* AF_UNSPEC is "any" or "none"--treat it as AF_INET */
prefix->bitlen = (bitlen >= 0) ? bitlen : 32; prefix->bitlen = (bitlen >= 0) ? bitlen : 32;
memcpy(&prefix->add.sin, dest, 4); memmove(&prefix->add.sin, dest, 4);
} }
prefix->family = family; prefix->family = family;

View File

@ -209,7 +209,7 @@ transform(isc_uint32_t state[5], const unsigned char buffer[64]) {
INSIST(state != NULL); INSIST(state != NULL);
block = &workspace; block = &workspace;
(void)memcpy(block, buffer, 64); (void)memmove(block, buffer, 64);
/* Copy context->state[] to working vars */ /* Copy context->state[] to working vars */
a = state[0]; a = state[0];
@ -301,7 +301,7 @@ isc_sha1_update(isc_sha1_t *context, const unsigned char *data,
context->count[1] += (len >> 29) + 1; context->count[1] += (len >> 29) + 1;
j = (j >> 3) & 63; j = (j >> 3) & 63;
if ((j + len) > 63) { if ((j + len) > 63) {
(void)memcpy(&context->buffer[j], data, (i = 64 - j)); (void)memmove(&context->buffer[j], data, (i = 64 - j));
transform(context->state, context->buffer); transform(context->state, context->buffer);
for (; i + 63 < len; i += 64) for (; i + 63 < len; i += 64)
transform(context->state, &data[i]); transform(context->state, &data[i]);
@ -310,7 +310,7 @@ isc_sha1_update(isc_sha1_t *context, const unsigned char *data,
i = 0; i = 0;
} }
(void)memcpy(&context->buffer[j], &data[i], len - i); (void)memmove(&context->buffer[j], &data[i], len - i);
} }

View File

@ -560,8 +560,8 @@ isc_sha224_init(isc_sha224_t *context) {
if (context == (isc_sha256_t *)0) { if (context == (isc_sha256_t *)0) {
return; return;
} }
memcpy(context->state, sha224_initial_hash_value, memmove(context->state, sha224_initial_hash_value,
ISC_SHA256_DIGESTLENGTH); ISC_SHA256_DIGESTLENGTH);
memset(context->buffer, 0, ISC_SHA256_BLOCK_LENGTH); memset(context->buffer, 0, ISC_SHA256_BLOCK_LENGTH);
context->bitcount = 0; context->bitcount = 0;
} }
@ -580,7 +580,7 @@ void
isc_sha224_final(isc_uint8_t digest[], isc_sha224_t *context) { isc_sha224_final(isc_uint8_t digest[], isc_sha224_t *context) {
isc_uint8_t sha256_digest[ISC_SHA256_DIGESTLENGTH]; isc_uint8_t sha256_digest[ISC_SHA256_DIGESTLENGTH];
isc_sha256_final(sha256_digest, (isc_sha256_t *)context); isc_sha256_final(sha256_digest, (isc_sha256_t *)context);
memcpy(digest, sha256_digest, ISC_SHA224_DIGESTLENGTH); memmove(digest, sha256_digest, ISC_SHA224_DIGESTLENGTH);
memset(sha256_digest, 0, ISC_SHA256_DIGESTLENGTH); memset(sha256_digest, 0, ISC_SHA256_DIGESTLENGTH);
} }
@ -590,7 +590,7 @@ isc_sha256_init(isc_sha256_t *context) {
if (context == (isc_sha256_t *)0) { if (context == (isc_sha256_t *)0) {
return; return;
} }
memcpy(context->state, sha256_initial_hash_value, memmove(context->state, sha256_initial_hash_value,
ISC_SHA256_DIGESTLENGTH); ISC_SHA256_DIGESTLENGTH);
memset(context->buffer, 0, ISC_SHA256_BLOCK_LENGTH); memset(context->buffer, 0, ISC_SHA256_BLOCK_LENGTH);
context->bitcount = 0; context->bitcount = 0;
@ -803,7 +803,7 @@ isc_sha256_update(isc_sha256_t *context, const isc_uint8_t *data, size_t len) {
if (len >= freespace) { if (len >= freespace) {
/* Fill the buffer completely and process it */ /* Fill the buffer completely and process it */
memcpy(&context->buffer[usedspace], data, freespace); memmove(&context->buffer[usedspace], data, freespace);
context->bitcount += freespace << 3; context->bitcount += freespace << 3;
len -= freespace; len -= freespace;
data += freespace; data += freespace;
@ -811,7 +811,7 @@ isc_sha256_update(isc_sha256_t *context, const isc_uint8_t *data, size_t len) {
(isc_uint32_t*)context->buffer); (isc_uint32_t*)context->buffer);
} else { } else {
/* The buffer is not yet full */ /* The buffer is not yet full */
memcpy(&context->buffer[usedspace], data, len); memmove(&context->buffer[usedspace], data, len);
context->bitcount += len << 3; context->bitcount += len << 3;
/* Clean up: */ /* Clean up: */
usedspace = freespace = 0; usedspace = freespace = 0;
@ -822,7 +822,7 @@ isc_sha256_update(isc_sha256_t *context, const isc_uint8_t *data, size_t len) {
} }
while (len >= ISC_SHA256_BLOCK_LENGTH) { while (len >= ISC_SHA256_BLOCK_LENGTH) {
/* Process as many complete blocks as we can */ /* Process as many complete blocks as we can */
memcpy(context->buffer, data, ISC_SHA256_BLOCK_LENGTH); memmove(context->buffer, data, ISC_SHA256_BLOCK_LENGTH);
isc_sha256_transform(context, (isc_uint32_t*)context->buffer); isc_sha256_transform(context, (isc_uint32_t*)context->buffer);
context->bitcount += ISC_SHA256_BLOCK_LENGTH << 3; context->bitcount += ISC_SHA256_BLOCK_LENGTH << 3;
len -= ISC_SHA256_BLOCK_LENGTH; len -= ISC_SHA256_BLOCK_LENGTH;
@ -830,7 +830,7 @@ isc_sha256_update(isc_sha256_t *context, const isc_uint8_t *data, size_t len) {
} }
if (len > 0U) { if (len > 0U) {
/* There's left-overs, so save 'em */ /* There's left-overs, so save 'em */
memcpy(context->buffer, data, len); memmove(context->buffer, data, len);
context->bitcount += len << 3; context->bitcount += len << 3;
} }
/* Clean up: */ /* Clean up: */
@ -900,7 +900,7 @@ isc_sha256_final(isc_uint8_t digest[], isc_sha256_t *context) {
} }
} }
#else #else
memcpy(d, context->state, ISC_SHA256_DIGESTLENGTH); memmove(d, context->state, ISC_SHA256_DIGESTLENGTH);
#endif #endif
} }
@ -916,8 +916,8 @@ isc_sha512_init(isc_sha512_t *context) {
if (context == (isc_sha512_t *)0) { if (context == (isc_sha512_t *)0) {
return; return;
} }
memcpy(context->state, sha512_initial_hash_value, memmove(context->state, sha512_initial_hash_value,
ISC_SHA512_DIGESTLENGTH); ISC_SHA512_DIGESTLENGTH);
memset(context->buffer, 0, ISC_SHA512_BLOCK_LENGTH); memset(context->buffer, 0, ISC_SHA512_BLOCK_LENGTH);
context->bitcount[0] = context->bitcount[1] = 0; context->bitcount[0] = context->bitcount[1] = 0;
} }
@ -1122,7 +1122,7 @@ void isc_sha512_update(isc_sha512_t *context, const isc_uint8_t *data, size_t le
if (len >= freespace) { if (len >= freespace) {
/* Fill the buffer completely and process it */ /* Fill the buffer completely and process it */
memcpy(&context->buffer[usedspace], data, freespace); memmove(&context->buffer[usedspace], data, freespace);
ADDINC128(context->bitcount, freespace << 3); ADDINC128(context->bitcount, freespace << 3);
len -= freespace; len -= freespace;
data += freespace; data += freespace;
@ -1130,7 +1130,7 @@ void isc_sha512_update(isc_sha512_t *context, const isc_uint8_t *data, size_t le
(isc_uint64_t*)context->buffer); (isc_uint64_t*)context->buffer);
} else { } else {
/* The buffer is not yet full */ /* The buffer is not yet full */
memcpy(&context->buffer[usedspace], data, len); memmove(&context->buffer[usedspace], data, len);
ADDINC128(context->bitcount, len << 3); ADDINC128(context->bitcount, len << 3);
/* Clean up: */ /* Clean up: */
usedspace = freespace = 0; usedspace = freespace = 0;
@ -1141,7 +1141,7 @@ void isc_sha512_update(isc_sha512_t *context, const isc_uint8_t *data, size_t le
} }
while (len >= ISC_SHA512_BLOCK_LENGTH) { while (len >= ISC_SHA512_BLOCK_LENGTH) {
/* Process as many complete blocks as we can */ /* Process as many complete blocks as we can */
memcpy(context->buffer, data, ISC_SHA512_BLOCK_LENGTH); memmove(context->buffer, data, ISC_SHA512_BLOCK_LENGTH);
isc_sha512_transform(context, (isc_uint64_t*)context->buffer); isc_sha512_transform(context, (isc_uint64_t*)context->buffer);
ADDINC128(context->bitcount, ISC_SHA512_BLOCK_LENGTH << 3); ADDINC128(context->bitcount, ISC_SHA512_BLOCK_LENGTH << 3);
len -= ISC_SHA512_BLOCK_LENGTH; len -= ISC_SHA512_BLOCK_LENGTH;
@ -1149,7 +1149,7 @@ void isc_sha512_update(isc_sha512_t *context, const isc_uint8_t *data, size_t le
} }
if (len > 0U) { if (len > 0U) {
/* There's left-overs, so save 'em */ /* There's left-overs, so save 'em */
memcpy(context->buffer, data, len); memmove(context->buffer, data, len);
ADDINC128(context->bitcount, len << 3); ADDINC128(context->bitcount, len << 3);
} }
/* Clean up: */ /* Clean up: */
@ -1224,7 +1224,7 @@ void isc_sha512_final(isc_uint8_t digest[], isc_sha512_t *context) {
} }
} }
#else #else
memcpy(d, context->state, ISC_SHA512_DIGESTLENGTH); memmove(d, context->state, ISC_SHA512_DIGESTLENGTH);
#endif #endif
} }
@ -1239,8 +1239,8 @@ isc_sha384_init(isc_sha384_t *context) {
if (context == (isc_sha384_t *)0) { if (context == (isc_sha384_t *)0) {
return; return;
} }
memcpy(context->state, sha384_initial_hash_value, memmove(context->state, sha384_initial_hash_value,
ISC_SHA512_DIGESTLENGTH); ISC_SHA512_DIGESTLENGTH);
memset(context->buffer, 0, ISC_SHA384_BLOCK_LENGTH); memset(context->buffer, 0, ISC_SHA384_BLOCK_LENGTH);
context->bitcount[0] = context->bitcount[1] = 0; context->bitcount[0] = context->bitcount[1] = 0;
} }
@ -1277,7 +1277,7 @@ isc_sha384_final(isc_uint8_t digest[], isc_sha384_t *context) {
} }
} }
#else #else
memcpy(d, context->state, ISC_SHA384_DIGESTLENGTH); memmove(d, context->state, ISC_SHA384_DIGESTLENGTH);
#endif #endif
} }

View File

@ -332,7 +332,7 @@ isc_sockaddr_v6fromin(isc_sockaddr_t *sockaddr, const struct in_addr *ina,
#endif #endif
sockaddr->type.sin6.sin6_addr.s6_addr[10] = 0xff; sockaddr->type.sin6.sin6_addr.s6_addr[10] = 0xff;
sockaddr->type.sin6.sin6_addr.s6_addr[11] = 0xff; sockaddr->type.sin6.sin6_addr.s6_addr[11] = 0xff;
memcpy(&sockaddr->type.sin6.sin6_addr.s6_addr[12], ina, 4); memmove(&sockaddr->type.sin6.sin6_addr.s6_addr[12], ina, 4);
sockaddr->type.sin6.sin6_port = htons(port); sockaddr->type.sin6.sin6_port = htons(port);
sockaddr->length = sizeof(sockaddr->type.sin6); sockaddr->length = sizeof(sockaddr->type.sin6);
ISC_LINK_INIT(sockaddr, link); ISC_LINK_INIT(sockaddr, link);
@ -386,7 +386,7 @@ isc_sockaddr_fromnetaddr(isc_sockaddr_t *sockaddr, const isc_netaddr_t *na,
#ifdef ISC_PLATFORM_HAVESALEN #ifdef ISC_PLATFORM_HAVESALEN
sockaddr->type.sin6.sin6_len = sizeof(sockaddr->type.sin6); sockaddr->type.sin6.sin6_len = sizeof(sockaddr->type.sin6);
#endif #endif
memcpy(&sockaddr->type.sin6.sin6_addr, &na->type.in6, 16); memmove(&sockaddr->type.sin6.sin6_addr, &na->type.in6, 16);
#ifdef ISC_PLATFORM_HAVESCOPEID #ifdef ISC_PLATFORM_HAVESCOPEID
sockaddr->type.sin6.sin6_scope_id = isc_netaddr_getzone(na); sockaddr->type.sin6.sin6_scope_id = isc_netaddr_getzone(na);
#endif #endif

View File

@ -275,8 +275,8 @@ copy_counters(isc_stats_t *stats) {
} }
#else #else
UNUSED(i); UNUSED(i);
memcpy(stats->copiedcounters, stats->counters, memmove(stats->copiedcounters, stats->counters,
stats->ncounters * sizeof(isc_stat_t)); stats->ncounters * sizeof(isc_stat_t));
#endif #endif
#ifdef ISC_RWLOCK_USEATOMIC #ifdef ISC_RWLOCK_USEATOMIC

View File

@ -188,7 +188,7 @@ isc_string_regiondup(isc_mem_t *mctx, const isc_region_t *source) {
target = (char *) isc_mem_allocate(mctx, source->length + 1); target = (char *) isc_mem_allocate(mctx, source->length + 1);
if (target != NULL) { if (target != NULL) {
memcpy(source->base, target, source->length); memmove(source->base, target, source->length);
target[source->length] = '\0'; target[source->length] = '\0';
} }

View File

@ -964,7 +964,7 @@ ATF_TC_BODY(isc_hmacsha1, tc) {
hash_test_key_t *test_key = test_keys; hash_test_key_t *test_key = test_keys;
while (testcase->input != NULL && testcase->result != NULL) { while (testcase->input != NULL && testcase->result != NULL) {
memcpy(buffer, test_key->key, test_key->len); memmove(buffer, test_key->key, test_key->len);
isc_hmacsha1_init(&hmacsha1, buffer, test_key->len); isc_hmacsha1_init(&hmacsha1, buffer, test_key->len);
isc_hmacsha1_update(&hmacsha1, isc_hmacsha1_update(&hmacsha1,
(const isc_uint8_t *) testcase->input, (const isc_uint8_t *) testcase->input,
@ -1127,7 +1127,7 @@ ATF_TC_BODY(isc_hmacsha224, tc) {
hash_test_key_t *test_key = test_keys; hash_test_key_t *test_key = test_keys;
while (testcase->input != NULL && testcase->result != NULL) { while (testcase->input != NULL && testcase->result != NULL) {
memcpy(buffer, test_key->key, test_key->len); memmove(buffer, test_key->key, test_key->len);
isc_hmacsha224_init(&hmacsha224, buffer, test_key->len); isc_hmacsha224_init(&hmacsha224, buffer, test_key->len);
isc_hmacsha224_update(&hmacsha224, isc_hmacsha224_update(&hmacsha224,
(const isc_uint8_t *) testcase->input, (const isc_uint8_t *) testcase->input,
@ -1290,7 +1290,7 @@ ATF_TC_BODY(isc_hmacsha256, tc) {
hash_test_key_t *test_key = test_keys; hash_test_key_t *test_key = test_keys;
while (testcase->input != NULL && testcase->result != NULL) { while (testcase->input != NULL && testcase->result != NULL) {
memcpy(buffer, test_key->key, test_key->len); memmove(buffer, test_key->key, test_key->len);
isc_hmacsha256_init(&hmacsha256, buffer, test_key->len); isc_hmacsha256_init(&hmacsha256, buffer, test_key->len);
isc_hmacsha256_update(&hmacsha256, isc_hmacsha256_update(&hmacsha256,
(const isc_uint8_t *) testcase->input, (const isc_uint8_t *) testcase->input,
@ -1459,7 +1459,7 @@ ATF_TC_BODY(isc_hmacsha384, tc) {
hash_test_key_t *test_key = test_keys; hash_test_key_t *test_key = test_keys;
while (testcase->input != NULL && testcase->result != NULL) { while (testcase->input != NULL && testcase->result != NULL) {
memcpy(buffer, test_key->key, test_key->len); memmove(buffer, test_key->key, test_key->len);
isc_hmacsha384_init(&hmacsha384, buffer, test_key->len); isc_hmacsha384_init(&hmacsha384, buffer, test_key->len);
isc_hmacsha384_update(&hmacsha384, isc_hmacsha384_update(&hmacsha384,
(const isc_uint8_t *) testcase->input, (const isc_uint8_t *) testcase->input,
@ -1628,7 +1628,7 @@ ATF_TC_BODY(isc_hmacsha512, tc) {
hash_test_key_t *test_key = test_keys; hash_test_key_t *test_key = test_keys;
while (testcase->input != NULL && testcase->result != NULL) { while (testcase->input != NULL && testcase->result != NULL) {
memcpy(buffer, test_key->key, test_key->len); memmove(buffer, test_key->key, test_key->len);
isc_hmacsha512_init(&hmacsha512, buffer, test_key->len); isc_hmacsha512_init(&hmacsha512, buffer, test_key->len);
isc_hmacsha512_update(&hmacsha512, isc_hmacsha512_update(&hmacsha512,
(const isc_uint8_t *) testcase->input, (const isc_uint8_t *) testcase->input,
@ -1771,7 +1771,7 @@ ATF_TC_BODY(isc_hmacmd5, tc) {
hash_test_key_t *test_key = test_keys; hash_test_key_t *test_key = test_keys;
while (testcase->input != NULL && testcase->result != NULL) { while (testcase->input != NULL && testcase->result != NULL) {
memcpy(buffer, test_key->key, test_key->len); memmove(buffer, test_key->key, test_key->len);
isc_hmacmd5_init(&hmacmd5, buffer, test_key->len); isc_hmacmd5_init(&hmacmd5, buffer, test_key->len);
isc_hmacmd5_update(&hmacmd5, isc_hmacmd5_update(&hmacmd5,
(const isc_uint8_t *) testcase->input, (const isc_uint8_t *) testcase->input,

Some files were not shown because too many files have changed in this diff Show More