mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-12 13:58:58 -04:00
Fix a merge problem in which name_from_addr returned pointers to the stack; found by Jiang Hong.
svn:r934
This commit is contained in:
parent
1fc7059cbe
commit
d2386bce75
@ -1,5 +1,6 @@
|
||||
Changes in 1.4.8-stable:
|
||||
o Match the query in DNS replies to the query in the request; from Vsevolod Stakhov.
|
||||
o Fix a merge problem in which name_from_addr returned pointers to the stack; found by Jiang Hong.
|
||||
|
||||
Changes in 1.4.7-stable:
|
||||
o Fix a bug where headers arriving in multiple packets were not parsed; fix from Jiang Hong; test by me.
|
||||
|
10
http.c
10
http.c
@ -2488,6 +2488,12 @@ evhttp_get_request_connection(
|
||||
char *hostname = NULL, *portname = NULL;
|
||||
|
||||
name_from_addr(sa, salen, &hostname, &portname);
|
||||
if (hostname == NULL || portname == NULL) {
|
||||
if (hostname) free(hostname);
|
||||
if (portname) free(portname);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
event_debug(("%s: new request from %s:%s on %d\n",
|
||||
__func__, hostname, portname, fd));
|
||||
|
||||
@ -2614,8 +2620,8 @@ name_from_addr(struct sockaddr *sa, socklen_t salen,
|
||||
if (ni_result != 0)
|
||||
return;
|
||||
#endif
|
||||
*phost = ntop;
|
||||
*pport = strport;
|
||||
*phost = strdup(ntop);
|
||||
*pport = strdup(strport);
|
||||
}
|
||||
|
||||
/* Either connect or bind */
|
||||
|
Loading…
x
Reference in New Issue
Block a user