From e3c1a6d3c8ca609923a87635d208472db2e384e6 Mon Sep 17 00:00:00 2001 From: Rozhuk Ivan Date: Sat, 13 Dec 2014 11:59:42 +0000 Subject: memmove -> memcpy in some cases, review req git-svn-id: http://svn.miranda-ng.org/main/trunk@11367 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- .../ClientChangeNotify/src/CommonLibs/TMyArray.h | 4 +- plugins/Clist_modern/src/modern_skinengine.cpp | 2 +- plugins/Clist_modern/src/modern_skinselector.cpp | 2 +- plugins/CryptoPP/src/GPGw/gpg_main.cpp | 4 +- plugins/IEHistory/src/dlgHandlers.cpp | 2 +- plugins/ListeningTo/src/music.cpp | 2 +- plugins/MirOTR/libotr-3.2.0/src/auth.c | 54 +++++++++++----------- plugins/MirOTR/libotr-3.2.0/src/b64.c | 2 +- plugins/MirOTR/libotr-3.2.0/src/context.c | 4 +- plugins/MirOTR/libotr-3.2.0/src/dh.c | 4 +- plugins/MirOTR/libotr-3.2.0/src/proto.c | 20 ++++---- protocols/MRA/src/MraAvatars.cpp | 4 +- protocols/MRA/src/MraFilesQueue.cpp | 14 +++--- protocols/MRA/src/MraMRIMProxy.cpp | 2 +- protocols/MRA/src/MraRTFMsg.cpp | 8 ++-- protocols/MRA/src/Mra_functions.cpp | 14 +++--- protocols/Sametime/src/glib/giowin32.c | 4 +- protocols/Sametime/src/glib/gmain.c | 2 +- src/modules/addcontact/addcontact.cpp | 4 +- 19 files changed, 76 insertions(+), 76 deletions(-) diff --git a/plugins/ClientChangeNotify/src/CommonLibs/TMyArray.h b/plugins/ClientChangeNotify/src/CommonLibs/TMyArray.h index 68ca908fe1..3e676bf816 100644 --- a/plugins/ClientChangeNotify/src/CommonLibs/TMyArray.h +++ b/plugins/ClientChangeNotify/src/CommonLibs/TMyArray.h @@ -171,7 +171,7 @@ __forceinline void TMyArray::MoveElem(int nInde return; // nothing to do } char Elem[sizeof(T)]; - memmove(Elem, pData + nIndex, sizeof(T)); + memcpy(Elem, pData + nIndex, sizeof(T)); if (nIndex < nMoveTo) { memmove(pData + nIndex, pData + nIndex + 1, sizeof(T) * (nMoveTo - nIndex)); @@ -179,7 +179,7 @@ __forceinline void TMyArray::MoveElem(int nInde { memmove(pData + nMoveTo + 1, pData + nMoveTo, sizeof(T) * (nIndex - nMoveTo)); } - memmove(pData + nMoveTo, Elem, sizeof(T)); + memcpy(pData + nMoveTo, Elem, sizeof(T)); } template diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp index 8ca58b8255..fcf7b55e8c 100644 --- a/plugins/Clist_modern/src/modern_skinengine.cpp +++ b/plugins/Clist_modern/src/modern_skinengine.cpp @@ -3727,7 +3727,7 @@ TCHAR *ske_ParseText(TCHAR *stzText) break; if (curpos - stpos > 0) { TCHAR *var = (TCHAR *)mir_alloc((curpos - stpos + 1)*sizeof(TCHAR)); - memmove(var, stzText + stpos, (curpos - stpos)*sizeof(TCHAR)); + memcpy(var, stzText + stpos, (curpos - stpos)*sizeof(TCHAR)); var[curpos - stpos] = (TCHAR)'\0'; var = ske_ReplaceVar(var); result = ske_ReAppend(result, var, 0); diff --git a/plugins/Clist_modern/src/modern_skinselector.cpp b/plugins/Clist_modern/src/modern_skinselector.cpp index 6a95c9acb5..c2c6f1320a 100644 --- a/plugins/Clist_modern/src/modern_skinselector.cpp +++ b/plugins/Clist_modern/src/modern_skinselector.cpp @@ -169,7 +169,7 @@ int DeleteMaskByItID(DWORD mID, LISTMODERNMASK *mmTemplateList) DWORD i; SkinSelector_DeleteMask(&(mmTemplateList->pl_Masks[mID])); newAlocation = (MODERNMASK *)mir_alloc(sizeof(MODERNMASK)*mmTemplateList->dwMaskCnt-1); - memmove(newAlocation,mmTemplateList->pl_Masks,sizeof(MODERNMASK)*(mID+1)); + memcpy(newAlocation,mmTemplateList->pl_Masks,sizeof(MODERNMASK)*(mID+1)); for (i = mID; i < mmTemplateList->dwMaskCnt-1; i++) { newAlocation[i] = mmTemplateList->pl_Masks[i+1]; diff --git a/plugins/CryptoPP/src/GPGw/gpg_main.cpp b/plugins/CryptoPP/src/GPGw/gpg_main.cpp index 6b23f540f7..fc544ffa52 100644 --- a/plugins/CryptoPP/src/GPGw/gpg_main.cpp +++ b/plugins/CryptoPP/src/GPGw/gpg_main.cpp @@ -176,7 +176,7 @@ LPSTR __cdecl _gpg_encrypt(LPCSTR message, LPCSTR keyid) encmessagelen = strlen(buffer)+1; encmessage = (char *) LocalAlloc(LPTR,encmessagelen); - memmove(encmessage, buffer, encmessagelen); + memcpy(encmessage, buffer, encmessagelen); } return encmessage; @@ -256,7 +256,7 @@ LPSTR __cdecl _gpg_decrypt(LPCSTR message) decmessagelen = strlen(buffer)+1; decmessage = (char *) LocalAlloc(LPTR,decmessagelen); - memmove(decmessage, buffer, decmessagelen); + memcpy(decmessage, buffer, decmessagelen); } return decmessage; diff --git a/plugins/IEHistory/src/dlgHandlers.cpp b/plugins/IEHistory/src/dlgHandlers.cpp index 8e0f815946..2272427fbe 100644 --- a/plugins/IEHistory/src/dlgHandlers.cpp +++ b/plugins/IEHistory/src/dlgHandlers.cpp @@ -190,7 +190,7 @@ DWORD WINAPI WorkerThread(LPVOID lpvData) messages[i] = (PBYTE)realloc(messages[i], newSize); dbInfo.cbBlob = newSize; if (!db_event_get(dbEvent, &dbInfo)) { - memmove(messages[i], dbInfo.pBlob, newSize); + memcpy(messages[i], dbInfo.pBlob, newSize); FillIEViewInfo(&ieData[i], dbInfo, messages[i]); } //FillIEViewEventData(&ieData[i], dbEvent); diff --git a/plugins/ListeningTo/src/music.cpp b/plugins/ListeningTo/src/music.cpp index b1c7e9b1de..2495c09bfd 100644 --- a/plugins/ListeningTo/src/music.cpp +++ b/plugins/ListeningTo/src/music.cpp @@ -139,7 +139,7 @@ int ChangedListeningInfo() FreeListeningInfo(¤t); - memmove(¤t, <i, sizeof(current)); + memcpy(¤t, <i, sizeof(current)); changed = 1; } diff --git a/plugins/MirOTR/libotr-3.2.0/src/auth.c b/plugins/MirOTR/libotr-3.2.0/src/auth.c index de6964517f..978c986613 100644 --- a/plugins/MirOTR/libotr-3.2.0/src/auth.c +++ b/plugins/MirOTR/libotr-3.2.0/src/auth.c @@ -157,21 +157,21 @@ gcry_error_t otrl_auth_start_v2(OtrlAuthInfo *auth) buf = bufp; buflen = lenp; - memmove(bufp, "\x00\x02\x02", 3); /* header */ + memcpy(bufp, "\x00\x02\x02", 3); /* header */ debug_data("Header", bufp, 3); bufp += 3; lenp -= 3; /* Encrypted g^x */ write_int(auth->encgx_len); debug_int("Enc gx len", bufp-4); - memmove(bufp, auth->encgx, auth->encgx_len); + memcpy(bufp, auth->encgx, auth->encgx_len); debug_data("Enc gx", bufp, auth->encgx_len); bufp += auth->encgx_len; lenp -= auth->encgx_len; /* Hashed g^x */ write_int(32); debug_int("hashgx len", bufp-4); - memmove(bufp, auth->hashgx, 32); + memcpy(bufp, auth->hashgx, 32); debug_data("hashgx", bufp, 32); bufp += 32; lenp -= 32; @@ -211,7 +211,7 @@ static gcry_error_t create_key_message(OtrlAuthInfo *auth) bufp = buf; lenp = buflen; - memmove(bufp, "\x00\x02\x0a", 3); /* header */ + memcpy(bufp, "\x00\x02\x0a", 3); /* header */ debug_data("Header", bufp, 3); bufp += 3; lenp -= 3; @@ -263,14 +263,14 @@ gcry_error_t otrl_auth_handle_commit(OtrlAuthInfo *auth, require_len(enclen); encbuf = malloc(enclen); if (encbuf == NULL && enclen > 0) goto memerr; - memmove(encbuf, bufp, enclen); + memcpy(encbuf, bufp, enclen); bufp += enclen; lenp -= enclen; /* Hashed g^x */ read_int(hashlen); if (hashlen != 32) goto invval; require_len(32); - memmove(hashbuf, bufp, 32); + memcpy(hashbuf, bufp, 32); bufp += 32; lenp -= 32; if (lenp != 0) goto invval; @@ -289,7 +289,7 @@ gcry_error_t otrl_auth_handle_commit(OtrlAuthInfo *auth, auth->encgx = encbuf; encbuf = NULL; auth->encgx_len = enclen; - memmove(auth->hashgx, hashbuf, 32); + memcpy(auth->hashgx, hashbuf, 32); /* Create a D-H Key Message */ err = create_key_message(auth); @@ -314,7 +314,7 @@ gcry_error_t otrl_auth_handle_commit(OtrlAuthInfo *auth, auth->encgx = encbuf; encbuf = NULL; auth->encgx_len = enclen; - memmove(auth->hashgx, hashbuf, 32); + memcpy(auth->hashgx, hashbuf, 32); /* Create a D-H Key Message */ err = create_key_message(auth); @@ -329,7 +329,7 @@ gcry_error_t otrl_auth_handle_commit(OtrlAuthInfo *auth, auth->encgx = encbuf; encbuf = NULL; auth->encgx_len = enclen; - memmove(auth->hashgx, hashbuf, 32); + memcpy(auth->hashgx, hashbuf, 32); break; } @@ -385,7 +385,7 @@ static gcry_error_t calculate_pubkey_auth(unsigned char **authbufp, bufp[0] = ((privkey->pubkey_type) >> 8) & 0xff; bufp[1] = (privkey->pubkey_type) & 0xff; bufp += 2; lenp -= 2; - memmove(bufp, privkey->pubkey_data, privkey->pubkey_datalen); + memcpy(bufp, privkey->pubkey_data, privkey->pubkey_datalen); debug_data("Pubkey", bufp, privkey->pubkey_datalen); bufp += privkey->pubkey_datalen; lenp -= privkey->pubkey_datalen; write_int(keyid); @@ -396,7 +396,7 @@ static gcry_error_t calculate_pubkey_auth(unsigned char **authbufp, /* Do the MAC */ gcry_md_reset(mackey); gcry_md_write(mackey, buf, totallen); - memmove(macbuf, gcry_md_read(mackey, GCRY_MD_SHA256), 32); + memcpy(macbuf, gcry_md_read(mackey, GCRY_MD_SHA256), 32); free(buf); buf = NULL; @@ -416,12 +416,12 @@ static gcry_error_t calculate_pubkey_auth(unsigned char **authbufp, bufp[0] = ((privkey->pubkey_type) >> 8) & 0xff; bufp[1] = (privkey->pubkey_type) & 0xff; bufp += 2; lenp -= 2; - memmove(bufp, privkey->pubkey_data, privkey->pubkey_datalen); + memcpy(bufp, privkey->pubkey_data, privkey->pubkey_datalen); debug_data("Pubkey", bufp, privkey->pubkey_datalen); bufp += privkey->pubkey_datalen; lenp -= privkey->pubkey_datalen; write_int(keyid); debug_int("Keyid", bufp-4); - memmove(bufp, sigbuf, siglen); + memcpy(bufp, sigbuf, siglen); debug_data("Signature", bufp, siglen); bufp += siglen; lenp -= siglen; free(sigbuf); @@ -523,7 +523,7 @@ static gcry_error_t check_pubkey_auth(unsigned char fingerprintbufp[20], bufp[0] = (pubkey_type >> 8) & 0xff; bufp[1] = pubkey_type & 0xff; bufp += 2; lenp -= 2; - memmove(bufp, fingerprintstart, fingerprintend - fingerprintstart); + memcpy(bufp, fingerprintstart, fingerprintend - fingerprintstart); debug_data("Pubkey", bufp, fingerprintend - fingerprintstart); bufp += fingerprintend - fingerprintstart; lenp -= fingerprintend - fingerprintstart; @@ -535,7 +535,7 @@ static gcry_error_t check_pubkey_auth(unsigned char fingerprintbufp[20], /* Do the MAC */ gcry_md_reset(mackey); gcry_md_write(mackey, buf, totallen); - memmove(macbuf, gcry_md_read(mackey, GCRY_MD_SHA256), 32); + memcpy(macbuf, gcry_md_read(mackey, GCRY_MD_SHA256), 32); free(buf); buf = NULL; @@ -588,20 +588,20 @@ static gcry_error_t create_revealsig_message(OtrlAuthInfo *auth, bufp = buf; lenp = buflen; - memmove(bufp, "\x00\x02\x11", 3); /* header */ + memcpy(bufp, "\x00\x02\x11", 3); /* header */ debug_data("Header", bufp, 3); bufp += 3; lenp -= 3; /* r */ write_int(16); - memmove(bufp, auth->r, 16); + memcpy(bufp, auth->r, 16); debug_data("r", bufp, 16); bufp += 16; lenp -= 16; /* Encrypted authenticator */ startmac = bufp; write_int(authlen); - memmove(bufp, authbuf, authlen); + memcpy(bufp, authbuf, authlen); debug_data("auth", bufp, authlen); bufp += authlen; lenp -= authlen; free(authbuf); @@ -610,7 +610,7 @@ static gcry_error_t create_revealsig_message(OtrlAuthInfo *auth, /* MAC it, but only take the first 20 bytes */ gcry_md_reset(auth->mac_m2); gcry_md_write(auth->mac_m2, startmac, bufp - startmac); - memmove(bufp, gcry_md_read(auth->mac_m2, GCRY_MD_SHA256), 20); + memcpy(bufp, gcry_md_read(auth->mac_m2, GCRY_MD_SHA256), 20); debug_data("MAC", bufp, 20); bufp += 20; lenp -= 20; @@ -660,14 +660,14 @@ static gcry_error_t create_signature_message(OtrlAuthInfo *auth, bufp = buf; lenp = buflen; - memmove(bufp, "\x00\x02\x12", 3); /* header */ + memcpy(bufp, "\x00\x02\x12", 3); /* header */ debug_data("Header", bufp, 3); bufp += 3; lenp -= 3; /* Encrypted authenticator */ startmac = bufp; write_int(authlen); - memmove(bufp, authbuf, authlen); + memcpy(bufp, authbuf, authlen); debug_data("auth", bufp, authlen); bufp += authlen; lenp -= authlen; free(authbuf); @@ -676,7 +676,7 @@ static gcry_error_t create_signature_message(OtrlAuthInfo *auth, /* MAC it, but only take the first 20 bytes */ gcry_md_reset(auth->mac_m2p); gcry_md_write(auth->mac_m2p, startmac, bufp - startmac); - memmove(bufp, gcry_md_read(auth->mac_m2p, GCRY_MD_SHA256), 20); + memcpy(bufp, gcry_md_read(auth->mac_m2p, GCRY_MD_SHA256), 20); debug_data("MAC", bufp, 20); bufp += 20; lenp -= 20; @@ -825,7 +825,7 @@ gcry_error_t otrl_auth_handle_revealsig(OtrlAuthInfo *auth, read_int(rlen); if (rlen != 16) goto invval; require_len(rlen); - memmove(auth->r, bufp, rlen); + memcpy(auth->r, bufp, rlen); bufp += rlen; lenp -= rlen; /* auth */ @@ -1086,7 +1086,7 @@ static gcry_error_t create_v1_key_exchange_message(OtrlAuthInfo *auth, bufp = buf; lenp = totallen; - memmove(bufp, "\x00\x01\x0a", 3); /* header */ + memcpy(bufp, "\x00\x01\x0a", 3); /* header */ debug_data("Header", bufp, 3); bufp += 3; lenp -= 3; @@ -1094,7 +1094,7 @@ static gcry_error_t create_v1_key_exchange_message(OtrlAuthInfo *auth, debug_data("Reply", bufp, 1); bufp += 1; lenp -= 1; - memmove(bufp, privkey->pubkey_data, privkey->pubkey_datalen); + memcpy(bufp, privkey->pubkey_data, privkey->pubkey_datalen); debug_data("Pubkey", bufp, privkey->pubkey_datalen); bufp += privkey->pubkey_datalen; lenp -= privkey->pubkey_datalen; @@ -1110,7 +1110,7 @@ static gcry_error_t create_v1_key_exchange_message(OtrlAuthInfo *auth, if (err) goto err; if (siglen != 40) goto invval; - memmove(bufp, sigbuf, 40); + memcpy(bufp, sigbuf, 40); debug_data("Signature", bufp, 40); bufp += 40; lenp -= 40; free(sigbuf); @@ -1265,7 +1265,7 @@ gcry_error_t otrl_auth_handle_v1_key_exchange(OtrlAuthInfo *auth, gcry_mpi_release(auth->their_pub); auth->their_pub = received_pub; received_pub = NULL; - memmove(auth->their_fingerprint, fingerprintbuf, 20); + memcpy(auth->their_fingerprint, fingerprintbuf, 20); if (received_reply == 0x01) { /* Don't send a reply to this. */ diff --git a/plugins/MirOTR/libotr-3.2.0/src/b64.c b/plugins/MirOTR/libotr-3.2.0/src/b64.c index b8736daf26..222f56634c 100644 --- a/plugins/MirOTR/libotr-3.2.0/src/b64.c +++ b/plugins/MirOTR/libotr-3.2.0/src/b64.c @@ -202,7 +202,7 @@ char *otrl_base64_otr_encode(const unsigned char *buf, size_t buflen) if (base64buf == NULL) { return NULL; } - memmove(base64buf, "?OTR:", 5); + memcpy(base64buf, "?OTR:", 5); otrl_base64_encode(base64buf+5, buf, buflen); base64buf[5 + base64len] = '.'; base64buf[5 + base64len + 1] = '\0'; diff --git a/plugins/MirOTR/libotr-3.2.0/src/context.c b/plugins/MirOTR/libotr-3.2.0/src/context.c index 8807b89145..d0d912f76a 100644 --- a/plugins/MirOTR/libotr-3.2.0/src/context.c +++ b/plugins/MirOTR/libotr-3.2.0/src/context.c @@ -157,7 +157,7 @@ Fingerprint *otrl_context_find_fingerprint(ConnContext *context, assert(f != NULL); f->fingerprint = malloc(20); assert(f->fingerprint != NULL); - memmove(f->fingerprint, fingerprint, 20); + memcpy(f->fingerprint, fingerprint, 20); f->context = context; f->trust = NULL; f->next = context->fingerprint_root.next; @@ -193,7 +193,7 @@ void otrl_context_set_preshared_secret(ConnContext *context, if (secret_len) { context->preshared_secret = malloc(secret_len); if (context->preshared_secret) { - memmove(context->preshared_secret, secret, secret_len); + memcpy(context->preshared_secret, secret, secret_len); context->preshared_secret_len = secret_len; } } diff --git a/plugins/MirOTR/libotr-3.2.0/src/dh.c b/plugins/MirOTR/libotr-3.2.0/src/dh.c index 610c84e143..e23788dd08 100644 --- a/plugins/MirOTR/libotr-3.2.0/src/dh.c +++ b/plugins/MirOTR/libotr-3.2.0/src/dh.c @@ -273,7 +273,7 @@ gcry_error_t otrl_dh_compute_v2_auth_keys(const DH_keypair *our_dh, } sdata[0] = 0x00; gcry_md_hash_buffer(GCRY_MD_SHA256, hashdata, sdata, slen+5); - memmove(sessionid, hashdata, 8); + memcpy(sessionid, hashdata, 8); *sessionidlenp = 8; /* Calculate the encryption keys */ @@ -398,7 +398,7 @@ gcry_error_t otrl_dh_compute_v1_session_id(const DH_keypair *our_dh, } sdata[0] = 0x00; gcry_md_hash_buffer(GCRY_MD_SHA1, hashdata, sdata, slen+5); - memmove(sessionid, hashdata, 20); + memcpy(sessionid, hashdata, 20); *sessionidlenp = 20; /* Which half should be bold? */ diff --git a/plugins/MirOTR/libotr-3.2.0/src/proto.c b/plugins/MirOTR/libotr-3.2.0/src/proto.c index 9f76455a9f..307ab047ff 100644 --- a/plugins/MirOTR/libotr-3.2.0/src/proto.c +++ b/plugins/MirOTR/libotr-3.2.0/src/proto.c @@ -417,9 +417,9 @@ gcry_error_t otrl_proto_create_data(char **encmessagep, ConnContext *context, bufp = buf; lenp = buflen; if (version == 1) { - memmove(bufp, "\x00\x01\x03", 3); /* header */ + memcpy(bufp, "\x00\x01\x03", 3); /* header */ } else { - memmove(bufp, "\x00\x02\x03", 3); /* header */ + memcpy(bufp, "\x00\x02\x03", 3); /* header */ } debug_data("Header", bufp, 3); bufp += 3; lenp -= 3; @@ -435,7 +435,7 @@ gcry_error_t otrl_proto_create_data(char **encmessagep, ConnContext *context, write_mpi(context->our_dh_key.pub, pubkeylen, "Y"); /* Y */ otrl_dh_incctr(sess->sendctr); - memmove(bufp, sess->sendctr, 8); /* Counter (top 8 bytes only) */ + memcpy(bufp, sess->sendctr, 8); /* Counter (top 8 bytes only) */ debug_data("Counter", bufp, 8); bufp += 8; lenp -= 8; @@ -454,7 +454,7 @@ gcry_error_t otrl_proto_create_data(char **encmessagep, ConnContext *context, gcry_md_reset(sess->sendmac); gcry_md_write(sess->sendmac, buf, bufp-buf); - memmove(bufp, gcry_md_read(sess->sendmac, GCRY_MD_SHA1), 20); + memcpy(bufp, gcry_md_read(sess->sendmac, GCRY_MD_SHA1), 20); debug_data("MAC", bufp, 20); bufp += 20; /* MAC */ lenp -= 20; @@ -463,7 +463,7 @@ gcry_error_t otrl_proto_create_data(char **encmessagep, ConnContext *context, debug_int("Revealed MAC length", bufp-4); if (reveallen > 0) { - memmove(bufp, context->saved_mac_keys, reveallen); + memcpy(bufp, context->saved_mac_keys, reveallen); debug_data("Revealed MAC data", bufp, reveallen); bufp += reveallen; lenp -= reveallen; free(context->saved_mac_keys); @@ -480,7 +480,7 @@ gcry_error_t otrl_proto_create_data(char **encmessagep, ConnContext *context, err = gcry_error(GPG_ERR_ENOMEM); goto err; } - memmove(base64buf, "?OTR:", 5); + memcpy(base64buf, "?OTR:", 5); otrl_base64_encode(base64buf+5, buf, buflen); base64buf[5 + base64len] = '.'; base64buf[5 + base64len + 1] = '\0'; @@ -636,7 +636,7 @@ gcry_error_t otrl_proto_accept_data(char **plaintextp, OtrlTLV **tlvsp, read_int(recipient_keyid); read_mpi(sender_next_y); require_len(8); - memmove(ctr, bufp, 8); + memcpy(ctr, bufp, 8); bufp += 8; lenp -= 8; read_int(datalen); require_len(datalen); @@ -645,12 +645,12 @@ gcry_error_t otrl_proto_accept_data(char **plaintextp, OtrlTLV **tlvsp, err = gcry_error(GPG_ERR_ENOMEM); goto err; } - memmove(data, bufp, datalen); + memcpy(data, bufp, datalen); data[datalen] = '\0'; bufp += datalen; lenp -= datalen; macend = bufp; require_len(20); - memmove(givenmac, bufp, 20); + memcpy(givenmac, bufp, 20); bufp += 20; lenp -= 20; read_int(reveallen); require_len(reveallen); @@ -698,7 +698,7 @@ gcry_error_t otrl_proto_accept_data(char **plaintextp, OtrlTLV **tlvsp, } /* Decrypt the message */ - memmove(sess->rcvctr, ctr, 8); + memcpy(sess->rcvctr, ctr, 8); err = gcry_cipher_reset(sess->rcvenc); if (err) goto err; err = gcry_cipher_setctr(sess->rcvenc, sess->rcvctr, 16); diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp index 0ddab4b217..2e92bd31d6 100644 --- a/protocols/MRA/src/MraAvatars.cpp +++ b/protocols/MRA/src/MraAvatars.cpp @@ -458,7 +458,7 @@ bool CMraProto::MraAvatarsGetContactTime(MCONTACT hContact, LPSTR lpszValueName, CMStringA szBuff; if (mraGetStringA(hContact, lpszValueName, szBuff)) if (InternetTimeGetTime(szBuff, itAvatarLastModifiedTimeLocal) == NO_ERROR) { - memmove(pstTime, &itAvatarLastModifiedTimeLocal.stTime, sizeof(SYSTEMTIME)); + memcpy(pstTime, &itAvatarLastModifiedTimeLocal.stTime, sizeof(SYSTEMTIME)); return true; } } @@ -474,7 +474,7 @@ void CMraProto::MraAvatarsSetContactTime(MCONTACT hContact, LPSTR lpszValueName, INTERNET_TIME itTime; if (pstTime) { itTime.lTimeZone = 0; - memmove(&itTime.stTime, pstTime, sizeof(SYSTEMTIME)); + memcpy(&itTime.stTime, pstTime, sizeof(SYSTEMTIME)); } else InternetTimeGetCurrentTime(&itTime); diff --git a/protocols/MRA/src/MraFilesQueue.cpp b/protocols/MRA/src/MraFilesQueue.cpp index 10b0678a9b..69f78f5899 100644 --- a/protocols/MRA/src/MraFilesQueue.cpp +++ b/protocols/MRA/src/MraFilesQueue.cpp @@ -241,7 +241,7 @@ size_t CMraProto::MraFilesQueueGetLocalAddressesList(LPSTR lpszBuff, size_t dwBu dwSelfExternalIP = ntohl(getDword("IP", 0)); if (dwSelfExternalIP) { - memmove(&btAddress, &dwSelfExternalIP, sizeof(DWORD)); + memcpy(&btAddress, &dwSelfExternalIP, sizeof(DWORD)); lpszCurPos += mir_snprintf(lpszCurPos, (dwBuffSize - ((size_t)lpszCurPos - (size_t)lpszBuff)), "%lu.%lu.%lu.%lu:%lu;", btAddress[0], btAddress[1], btAddress[2], btAddress[3], dwPort); } @@ -277,7 +277,7 @@ DWORD CMraProto::MraFilesQueueAccept(HANDLE hFilesQueueHandle, DWORD dwIDRequest MRA_FILES_THREADPROC_PARAMS *pmftpp = (MRA_FILES_THREADPROC_PARAMS*)mir_calloc(sizeof(MRA_FILES_THREADPROC_PARAMS)); dat->lpwszPath = (LPWSTR)mir_calloc((dwPathSize*sizeof(WCHAR))); dat->dwPathSize = dwPathSize; - memmove(dat->lpwszPath, lpwszPath, (dwPathSize*sizeof(WCHAR))); + memcpy(dat->lpwszPath, lpwszPath, (dwPathSize*sizeof(WCHAR))); if ((*(WCHAR*)(dat->lpwszPath + (dat->dwPathSize - 1))) != '\\') {// add slash at the end if needed (*(WCHAR*)(dat->lpwszPath + dat->dwPathSize)) = '\\'; @@ -542,13 +542,13 @@ HANDLE CMraProto::MraFilesQueueConnectIn(MRA_FILES_QUEUE_ITEM *dat) ShowFormattedErrorMessage(L"Files exchange: cant create listen soscket, will try connect to remonte host. Error", GetLastError()); //dwAddrListSize = 0; - memmove(szAddrList, MRA_FILES_NULL_ADDRR, sizeof(MRA_FILES_NULL_ADDRR)); + memcpy(szAddrList, MRA_FILES_NULL_ADDRR, sizeof(MRA_FILES_NULL_ADDRR)); dwAddrListSize = (sizeof(MRA_FILES_NULL_ADDRR)-1); } } // подставляем ложный адрес, чтобы точно не подключились и не слушаем порт else { - memmove(szAddrList, MRA_FILES_NULL_ADDRR, sizeof(MRA_FILES_NULL_ADDRR)); + memcpy(szAddrList, MRA_FILES_NULL_ADDRR, sizeof(MRA_FILES_NULL_ADDRR)); dwAddrListSize = (sizeof(MRA_FILES_NULL_ADDRR)-1); } @@ -777,8 +777,8 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter) //pfts.currentFileTime; //as seconds since 1970 if ((dat->dwPathSize + dat->pmfqfFiles[i].dwNameLen) < SIZEOF(wszFileName)) { - memmove(wszFileName, dat->lpwszPath, (dat->dwPathSize*sizeof(WCHAR))); - memmove((wszFileName + dat->dwPathSize), dat->pmfqfFiles[i].lpwszName, ((dat->pmfqfFiles[i].dwNameLen + 1)*sizeof(WCHAR))); + memcpy(wszFileName, dat->lpwszPath, (dat->dwPathSize*sizeof(WCHAR))); + memcpy((wszFileName + dat->dwPathSize), dat->pmfqfFiles[i].lpwszName, ((dat->pmfqfFiles[i].dwNameLen + 1)*sizeof(WCHAR))); wszFileName[dat->dwPathSize + dat->pmfqfFiles[i].dwNameLen] = 0; } else { @@ -794,7 +794,7 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter) ProtoBroadcastAck(dat->hContact, ACKTYPE_FILE, ACKRESULT_NEXTFILE, (HANDLE)dat->dwIDRequest, 0); //dwBuffSizeUsed = (mir_snprintf((LPSTR)btBuff, SIZEOF(btBuff), "%s %S", MRA_FT_GET_FILE, dat->pmfqfFiles[i].lpwszName)+1); - memmove(btBuff, MRA_FT_GET_FILE, sizeof(MRA_FT_GET_FILE)); + memcpy(btBuff, MRA_FT_GET_FILE, sizeof(MRA_FT_GET_FILE)); btBuff[(sizeof(MRA_FT_GET_FILE)-1)] = ' '; dwBuffSizeUsed = sizeof(MRA_FT_GET_FILE)+WideCharToMultiByte(MRA_CODE_PAGE, 0, dat->pmfqfFiles[i].lpwszName, dat->pmfqfFiles[i].dwNameLen, (LPSTR)(btBuff + sizeof(MRA_FT_GET_FILE)), (SIZEOF(btBuff) - sizeof(MRA_FT_GET_FILE)), NULL, NULL); btBuff[dwBuffSizeUsed] = 0; diff --git a/protocols/MRA/src/MraMRIMProxy.cpp b/protocols/MRA/src/MraMRIMProxy.cpp index 689c560cb5..a5757eca9d 100644 --- a/protocols/MRA/src/MraMRIMProxy.cpp +++ b/protocols/MRA/src/MraMRIMProxy.cpp @@ -40,7 +40,7 @@ DWORD MraMrimProxySetData(HANDLE hMraMrimProxyData, const CMStringA &szEmail, DW if (!szAddresses.IsEmpty()) MraAddrListGetFromBuff(szAddresses, &pmmpd->malAddrList); if (pmguidSessionID) - memmove(&pmmpd->mguidSessionID, pmguidSessionID, sizeof(MRA_GUID)); + memcpy(&pmmpd->mguidSessionID, pmguidSessionID, sizeof(MRA_GUID)); SetEvent(pmmpd->hWaitHandle); return 0; diff --git a/protocols/MRA/src/MraRTFMsg.cpp b/protocols/MRA/src/MraRTFMsg.cpp index 89e21c867a..ba61aae39f 100644 --- a/protocols/MRA/src/MraRTFMsg.cpp +++ b/protocols/MRA/src/MraRTFMsg.cpp @@ -161,7 +161,7 @@ DWORD MraSymbolsToRTFTags(DWORD dwFlags, LPSTR lpszMessage, size_t dwMessageSize dwMemPartToCopy = (lpszFounded[dwFirstFoundIndex]-lpszMessageCurPrev); if (lpszMessageConvertedMax > (lpszMessageConvertedCur+(dwMemPartToCopy+dwcRTFTagsCount[dwFirstFoundIndex]))) { MraTextToRTFData(lpszMessageCurPrev, dwMemPartToCopy, lpszMessageConvertedCur, (lpszMessageConvertedMax-lpszMessageConvertedCur), &i);lpszMessageConvertedCur += i; - memmove(lpszMessageConvertedCur, lpszRTFTags[dwFirstFoundIndex], dwcRTFTagsCount[dwFirstFoundIndex]);lpszMessageConvertedCur += dwcRTFTagsCount[dwFirstFoundIndex]; + memcpy(lpszMessageConvertedCur, lpszRTFTags[dwFirstFoundIndex], dwcRTFTagsCount[dwFirstFoundIndex]);lpszMessageConvertedCur += dwcRTFTagsCount[dwFirstFoundIndex]; lpszMessageCurPrev = (lpszFounded[dwFirstFoundIndex]+dwcSimbolsCount[dwFirstFoundIndex]); for (i = 0;i= (lpszMessageRTFCur+sizeof(PAR)+sizeof(CRLF)+2)) { - memmove(lpszMessageRTFCur, PAR, sizeof(PAR));lpszMessageRTFCur += (sizeof(PAR)-1); - memmove(lpszMessageRTFCur, CRLF, sizeof(CRLF));lpszMessageRTFCur += (sizeof(CRLF)-1); - memmove(lpszMessageRTFCur, "}", 2);lpszMessageRTFCur += 2; + memcpy(lpszMessageRTFCur, PAR, sizeof(PAR));lpszMessageRTFCur += (sizeof(PAR)-1); + memcpy(lpszMessageRTFCur, CRLF, sizeof(CRLF));lpszMessageRTFCur += (sizeof(CRLF)-1); + memcpy(lpszMessageRTFCur, "}", 2);lpszMessageRTFCur += 2; debugLogA("%s\n", szMessageRTF); return NO_ERROR; } diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index a0244d2a66..54b57e5a4e 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -217,7 +217,7 @@ bool DB_GetStaticStringW(MCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszValueN if (db_get_ws(hContact, lpszModule, lpszValueName, &dbv) == 0) { dwReadedStringLen = mir_wstrlen(dbv.pwszVal); if (lpwszRetBuff && (dwRetBuffSize > dwReadedStringLen)) { - memmove(lpwszRetBuff, dbv.pszVal, (dwReadedStringLen*sizeof(WCHAR)));//include null terminated + memcpy(lpwszRetBuff, dbv.pszVal, (dwReadedStringLen*sizeof(WCHAR)));//include null terminated (*((WCHAR*)(lpwszRetBuff + dwReadedStringLen))) = 0; bRet = true; } @@ -289,7 +289,7 @@ bool DB_GetContactSettingBlob(MCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszV if (db_get(hContact, lpszModule, lpszValueName, &dbv) == 0) { if (dbv.type == DBVT_BLOB) { if (dwRetBuffSize >= dbv.cpbVal) { - memmove(lpRet, dbv.pbVal, dbv.cpbVal); + memcpy(lpRet, dbv.pbVal, dbv.cpbVal); bRet = true; } if (pdwRetBuffSize) (*pdwRetBuffSize) = dbv.cpbVal; @@ -670,7 +670,7 @@ void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA & if (getByte("TrayIconNewMailClkToInbox", MRA_DEFAULT_TRAYICON_NEW_MAIL_CLK_TO_INBOX)) { strncpy(szServiceFunction, m_szModuleName, MAX_PATH); pszServiceFunctionName = szServiceFunction + strlen(m_szModuleName); - memmove(pszServiceFunctionName, MRA_GOTO_INBOX, sizeof(MRA_GOTO_INBOX)); + memcpy(pszServiceFunctionName, MRA_GOTO_INBOX, sizeof(MRA_GOTO_INBOX)); cle.pszService = szServiceFunction; } CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle); @@ -1239,7 +1239,7 @@ DWORD FindFile(LPWSTR lpszFolder, DWORD dwFolderLen, LPWSTR lpszFileName, DWORD prdsiItems = (RECURSION_DATA_STACK_ITEM*)mir_calloc(dwRecDeepAllocated*sizeof(RECURSION_DATA_STACK_ITEM)); if (prdsiItems) { dwPathLen = dwFolderLen; - memmove(szPath, lpszFolder, (dwPathLen*sizeof(WCHAR))); + memcpy(szPath, lpszFolder, (dwPathLen*sizeof(WCHAR))); if (szPath[(dwPathLen - 1)] != '\\') { szPath[dwPathLen] = '\\'; dwPathLen++; @@ -1259,7 +1259,7 @@ DWORD FindFile(LPWSTR lpszFolder, DWORD dwFolderLen, LPWSTR lpszFileName, DWORD if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, _T("."), 1) != CSTR_EQUAL) if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, _T(".."), 2) != CSTR_EQUAL) { prdsiItems[dwRecDeepCurPos].dwFileNameLen = (mir_wstrlen(prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName) + 1); - memmove((szPath + dwPathLen), prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, (prdsiItems[dwRecDeepCurPos].dwFileNameLen*sizeof(WCHAR))); + memcpy((szPath + dwPathLen), prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, (prdsiItems[dwRecDeepCurPos].dwFileNameLen*sizeof(WCHAR))); mir_tstrcat(szPath, _T("\\*.*")); dwPathLen += prdsiItems[dwRecDeepCurPos].dwFileNameLen; @@ -1279,13 +1279,13 @@ DWORD FindFile(LPWSTR lpszFolder, DWORD dwFolderLen, LPWSTR lpszFileName, DWORD else {// file if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, lpszFileName, dwFileNameLen) == CSTR_EQUAL) { prdsiItems[dwRecDeepCurPos].dwFileNameLen = mir_wstrlen(prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName); - memmove((szPath + dwPathLen), prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, ((prdsiItems[dwRecDeepCurPos].dwFileNameLen + 1)*sizeof(WCHAR))); + memcpy((szPath + dwPathLen), prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, ((prdsiItems[dwRecDeepCurPos].dwFileNameLen + 1)*sizeof(WCHAR))); dwFilePathLen = (dwPathLen + prdsiItems[dwRecDeepCurPos].dwFileNameLen); if (pdwRetFilePathLen) (*pdwRetFilePathLen) = dwFilePathLen; if (lpszRetFilePathName && dwRetFilePathLen) { dwFilePathLen = min(dwFilePathLen, dwRetFilePathLen); - memmove(lpszRetFilePathName, szPath, ((dwFilePathLen + 1)*sizeof(WCHAR))); + memcpy(lpszRetFilePathName, szPath, ((dwFilePathLen + 1)*sizeof(WCHAR))); } dwRetErrorCode = NO_ERROR; diff --git a/protocols/Sametime/src/glib/giowin32.c b/protocols/Sametime/src/glib/giowin32.c index 6ac7f2eb16..3a0b92655e 100644 --- a/protocols/Sametime/src/glib/giowin32.c +++ b/protocols/Sametime/src/glib/giowin32.c @@ -1048,7 +1048,7 @@ g_io_win32_msg_read (GIOChannel *channel, if (!PeekMessage (&msg, win32_channel->hwnd, 0, 0, PM_REMOVE)) return G_IO_STATUS_AGAIN; - memmove (buf, &msg, sizeof (MSG)); + memcpy(buf, &msg, sizeof (MSG)); *bytes_read = sizeof (MSG); return G_IO_STATUS_NORMAL; @@ -1072,7 +1072,7 @@ g_io_win32_msg_write (GIOChannel *channel, } /* In case of alignment problems */ - memmove (&msg, buf, sizeof (MSG)); + memcpy(&msg, buf, sizeof (MSG)); if (!PostMessage (win32_channel->hwnd, msg.message, msg.wParam, msg.lParam)) { gchar *emsg = g_win32_error_message (GetLastError ()); diff --git a/protocols/Sametime/src/glib/gmain.c b/protocols/Sametime/src/glib/gmain.c index 91e2a8e378..5bba96d60d 100644 --- a/protocols/Sametime/src/glib/gmain.c +++ b/protocols/Sametime/src/glib/gmain.c @@ -1799,7 +1799,7 @@ g_get_current_time (GTimeVal *result) g_return_if_fail (result != NULL); GetSystemTimeAsFileTime (&ft); - memmove (&time64, &ft, sizeof (FILETIME)); + memcpy(&time64, &ft, sizeof (FILETIME)); /* Convert from 100s of nanoseconds since 1601-01-01 * to Unix epoch. Yes, this is Y2038 unsafe. diff --git a/src/modules/addcontact/addcontact.cpp b/src/modules/addcontact/addcontact.cpp index 3a98550715..32fda286c7 100644 --- a/src/modules/addcontact/addcontact.cpp +++ b/src/modules/addcontact/addcontact.cpp @@ -241,11 +241,11 @@ INT_PTR AddContactDialog(WPARAM wParam, LPARAM lParam) return 1; ADDCONTACTSTRUCT *acs = (ADDCONTACTSTRUCT*)mir_alloc(sizeof(ADDCONTACTSTRUCT)); - memmove(acs, (ADDCONTACTSTRUCT*)lParam, sizeof(ADDCONTACTSTRUCT)); + memcpy(acs, (ADDCONTACTSTRUCT*)lParam, sizeof(ADDCONTACTSTRUCT)); if (acs->psr) { // bad! structures that are bigger than psr will cause crashes if they define pointers within unreachable structural space PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)mir_alloc(acs->psr->cbSize); - memmove(psr, acs->psr, acs->psr->cbSize); + memcpy(psr, acs->psr, acs->psr->cbSize); psr->nick = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)psr->nick) : mir_a2t((char*)psr->nick); psr->firstName = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)psr->firstName) : mir_a2t((char*)psr->firstName); psr->lastName = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)psr->lastName) : mir_a2t((char*)psr->lastName); -- cgit v1.2.3