Curl_addr2string: take an addrlen argument too

This allows the function to figure out if a unix domain socket has a
file name or not associated with it! When a socket is created with
socketpair(), as done in the fuzzer testing, the path struct member is
uninitialized and must not be accessed.

Bug: https://crbug.com/oss-fuzz/16699

Closes #4283
This commit is contained in:
Daniel Stenberg 2019-08-30 11:29:55 +02:00
parent cd68dfe831
commit 84ced9389e
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
5 changed files with 24 additions and 16 deletions

View file

@ -51,7 +51,8 @@ timediff_t Curl_timeleft(struct Curl_easy *data,
curl_socket_t Curl_getconnectinfo(struct Curl_easy *data,
struct connectdata **connp);
bool Curl_addr2string(struct sockaddr *sa, char *addr, long *port);
bool Curl_addr2string(struct sockaddr *sa, curl_socklen_t salen,
char *addr, long *port);
/*
* Check if a connection seems to be alive.