1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-11-18 15:20:56 +03:00

kex: fix overlapping memcpy() to memmove()

Noticed this when libasan started kicking out errors when sending in
MACs preferences that were not supported yet.

Reported-by: fourierules on github
Fixes #611
Closes #1000
This commit is contained in:
Viktor Szakats
2023-04-20 22:55:49 +00:00
parent 4e256cf18a
commit 437af7e88f

View File

@@ -4027,7 +4027,7 @@ libssh2_session_method_pref(LIBSSH2_SESSION * session, int method_type,
if(!kex_get_method_by_name(s, method_len, mlist)) {
/* Strip out unsupported method */
if(p) {
memcpy(s, p + 1, strlen(s) - method_len);
memmove(s, p + 1, strlen(s) - method_len);
}
else {
if(s > newprefs) {