mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-27 02:02:26 +00:00
If getaddrinfo() fails, it's not safe to dereference the struct addrinfo* it
passes back to us, so don't. [originally from svn r5167]
This commit is contained in:
parent
31133eb077
commit
258a87361a
@ -713,8 +713,10 @@ Socket sk_newlistener(char *srcaddr, int port, Plug plug, int local_host_only, i
|
|||||||
hints.ai_next = NULL;
|
hints.ai_next = NULL;
|
||||||
sprintf(portstr, "%d", port);
|
sprintf(portstr, "%d", port);
|
||||||
retcode = getaddrinfo(srcaddr, portstr, &hints, &ai);
|
retcode = getaddrinfo(srcaddr, portstr, &hints, &ai);
|
||||||
|
if (retcode = 0) {
|
||||||
addr = ai->ai_addr;
|
addr = ai->ai_addr;
|
||||||
addrlen = ai->ai_addrlen;
|
addrlen = ai->ai_addrlen;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
memset(&a,'\0',sizeof(struct sockaddr_in));
|
memset(&a,'\0',sizeof(struct sockaddr_in));
|
||||||
a.sin_family = AF_INET;
|
a.sin_family = AF_INET;
|
||||||
|
Loading…
Reference in New Issue
Block a user