valgrind was friendly enough to point out that doing memcpy() on overlapping
memory areas is a very bad idea so I changed this to memmove()
Этот коммит содержится в:
родитель
d27dd927cd
Коммит
76e8e81402
@ -149,7 +149,9 @@ libssh2_userauth_list(LIBSSH2_SESSION * session, const char *username,
|
|||||||
}
|
}
|
||||||
|
|
||||||
methods_len = libssh2_ntohu32(session->userauth_list_data + 1);
|
methods_len = libssh2_ntohu32(session->userauth_list_data + 1);
|
||||||
memcpy(session->userauth_list_data, session->userauth_list_data + 5,
|
|
||||||
|
/* Do note that the memory areas overlap! */
|
||||||
|
memmove(session->userauth_list_data, session->userauth_list_data + 5,
|
||||||
methods_len);
|
methods_len);
|
||||||
session->userauth_list_data[methods_len] = '\0';
|
session->userauth_list_data[methods_len] = '\0';
|
||||||
_libssh2_debug(session, LIBSSH2_DBG_AUTH, "Permitted auth methods: %s",
|
_libssh2_debug(session, LIBSSH2_DBG_AUTH, "Permitted auth methods: %s",
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user