os: Use memcpy() instead of memmove() when buffers are known not to overlap

Most of these came from a mass bcopy() -> memmove() substitution in 1993
with a commit comment of "Ansification (changed bfuncs -> mfuncs)"

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This commit is contained in:
Alan Coopersmith 2022-08-13 11:38:04 -07:00
parent dc5194bb5a
commit f8cbe96d14
5 changed files with 7 additions and 7 deletions

View File

@ -62,7 +62,7 @@ MitAddCookie(unsigned short data_length, const char *data, XID id)
} }
new->next = mit_auth; new->next = mit_auth;
mit_auth = new; mit_auth = new;
memmove(new->data, data, (int) data_length); memcpy(new->data, data, (size_t) data_length);
new->len = data_length; new->len = data_length;
new->id = id; new->id = id;
return 1; return 1;

View File

@ -70,7 +70,7 @@ authdes_ezdecode(const char *inmsg, int len)
why = AUTH_FAILED; /* generic error, since there is no AUTH_BADALLOC */ why = AUTH_FAILED; /* generic error, since there is no AUTH_BADALLOC */
return NULL; return NULL;
} }
memmove(temp_inmsg, inmsg, len); memcpy(temp_inmsg, inmsg, len);
memset((char *) &msg, 0, sizeof(msg)); memset((char *) &msg, 0, sizeof(msg));
memset((char *) &r, 0, sizeof(r)); memset((char *) &r, 0, sizeof(r));

View File

@ -1108,9 +1108,9 @@ set_font_authorizations(char **authorizations, int *authlen, void *client)
*p++ = (len) >> 8; *p++ = (len) >> 8;
*p++ = (len & 0xff); *p++ = (len & 0xff);
memmove(p, AUTHORIZATION_NAME, sizeof(AUTHORIZATION_NAME)); memcpy(p, AUTHORIZATION_NAME, sizeof(AUTHORIZATION_NAME));
p += sizeof(AUTHORIZATION_NAME); p += sizeof(AUTHORIZATION_NAME);
memmove(p, hnameptr, len); memcpy(p, hnameptr, len);
p += len; p += len;
#if defined(IPv6) && defined(AF_INET6) #if defined(IPv6) && defined(AF_INET6)
if (ai) { if (ai) {

View File

@ -356,8 +356,8 @@ XdmAddCookie(unsigned short data_length, const char *data, XID id)
return 0; return 0;
new->next = xdmAuth; new->next = xdmAuth;
xdmAuth = new; xdmAuth = new;
memmove(new->key.data, key_bits, (int) 8); memcpy(new->key.data, key_bits, 8);
memmove(new->rho.data, rho_bits, (int) 8); memcpy(new->rho.data, rho_bits, 8);
new->id = id; new->id = id;
return 1; return 1;
} }

View File

@ -1409,7 +1409,7 @@ get_addr_by_name(const char *argtype,
FatalError("Xserver: %s unknown host: %s\n", argtype, namestr); FatalError("Xserver: %s unknown host: %s\n", argtype, namestr);
} }
if (hep->h_length == sizeof(struct in_addr)) { if (hep->h_length == sizeof(struct in_addr)) {
memmove(&addr->sin_addr, hep->h_addr, hep->h_length); memcpy(&addr->sin_addr, hep->h_addr, hep->h_length);
*addrlen = sizeof(struct sockaddr_in); *addrlen = sizeof(struct sockaddr_in);
addr->sin_family = AF_INET; addr->sin_family = AF_INET;
addr->sin_port = htons(port); addr->sin_port = htons(port);