From 437af7e88f9ffd5080c54f1223d446769e9ad8a2 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 20 Apr 2023 22:55:49 +0000 Subject: [PATCH] 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 --- src/kex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kex.c b/src/kex.c index 2c526657..d8884c04 100644 --- a/src/kex.c +++ b/src/kex.c @@ -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) {