1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-24 00:58:48 -05:00

connect: zero variable on stack to silence valgrind complaint

Valgrind will complain that ssrem buffer usage if not explicit
initialized, hence initialize it to zero.

This completes the change intially started in commit 2c0d721215 ('ftp:
retry getpeername for FTP with TCP_FASTOPEN') where the ssloc buffer has
a similar memset to zero.

Signed-off-by: Hans-Christian Noren Egtvedt <hegtvedt@cisco.com>
Closes #6289
This commit is contained in:
Hans-Christian Noren Egtvedt 2020-12-09 10:42:59 +01:00 committed by Daniel Stenberg
parent 98dc917869
commit 8a10abaf85
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -680,6 +680,7 @@ void Curl_conninfo_remote(struct connectdata *conn, curl_socket_t sockfd)
struct Curl_sockaddr_storage ssrem; struct Curl_sockaddr_storage ssrem;
curl_socklen_t plen; curl_socklen_t plen;
plen = sizeof(struct Curl_sockaddr_storage); plen = sizeof(struct Curl_sockaddr_storage);
memset(&ssrem, 0, sizeof(ssrem));
if(getpeername(sockfd, (struct sockaddr*) &ssrem, &plen)) { if(getpeername(sockfd, (struct sockaddr*) &ssrem, &plen)) {
int error = SOCKERRNO; int error = SOCKERRNO;
failf(conn->data, "getpeername() failed with errno %d: %s", failf(conn->data, "getpeername() failed with errno %d: %s",