projects
/
m6w6
/
ext-http
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
- fix segv if http_absolute_uri returns NULL
[m6w6/ext-http]
/
http_url_api.c
diff --git
a/http_url_api.c
b/http_url_api.c
index 3fbf008e5329dfe63ac4e23f4086051be5e22f9e..163dec349de66318ef55d652df0fa951aaccbcaa 100644
(file)
--- a/
http_url_api.c
+++ b/
http_url_api.c
@@
-69,7
+69,7
@@
PHP_HTTP_API char *_http_absolute_url_ex(
} else if (purl->scheme) {
furl.scheme = purl->scheme;
#if defined(PHP_WIN32) || defined(HAVE_NETDB_H)
} else if (purl->scheme) {
furl.scheme = purl->scheme;
#if defined(PHP_WIN32) || defined(HAVE_NETDB_H)
- } else if (port && (se = getservbyport(
port
, "tcp"))) {
+ } else if (port && (se = getservbyport(
htons(port)
, "tcp"))) {
furl.scheme = (scheme = estrdup(se->s_name));
#endif
} else {
furl.scheme = (scheme = estrdup(se->s_name));
#endif
} else {
@@
-80,17
+80,17
@@
PHP_HTTP_API char *_http_absolute_url_ex(
furl.port = port;
} else if (purl->port) {
furl.port = purl->port;
furl.port = port;
} else if (purl->port) {
furl.port = purl->port;
- } else if (strncmp(furl.scheme, "http", 4)) {
+ } else if (
(!furl.scheme) ||
strncmp(furl.scheme, "http", 4)) {
#if defined(PHP_WIN32) || defined(HAVE_NETDB_H)
if ((se = getservbyname(furl.scheme, "tcp"))) {
#if defined(PHP_WIN32) || defined(HAVE_NETDB_H)
if ((se = getservbyname(furl.scheme, "tcp"))) {
- furl.port =
se->s_port
;
+ furl.port =
ntohs(se->s_port)
;
}
#endif
} else {
}
#endif
} else {
- furl.port = (furl.scheme[4] == 's') ? 443 : 80;
+ furl.port = (furl.scheme
&& furl.scheme
[4] == 's') ? 443 : 80;
}
}
- if (host) {
+ if (host
&& host_len
) {
furl.host = (char *) host;
} else if (purl->host) {
furl.host = purl->host;
furl.host = (char *) host;
} else if (purl->host) {
furl.host = purl->host;