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 possible crash with http_redirect() and http_build_url() called without parameters
[m6w6/ext-http]
/
http_url_api.c
diff --git
a/http_url_api.c
b/http_url_api.c
index cb0aeb5bd05d0eabcbfd018d71a4c30402d8e1ff..cb1b82f89363cdc7beb89668d784a916598d87a6 100644
(file)
--- a/
http_url_api.c
+++ b/
http_url_api.c
@@
-66,10
+66,15
@@
PHP_MINIT_FUNCTION(http_url)
PHP_HTTP_API char *_http_absolute_url(const char *url TSRMLS_DC)
{
PHP_HTTP_API char *_http_absolute_url(const char *url TSRMLS_DC)
{
- char *abs =
estrdup(url)
;
- php_url *purl =
php_url_parse(abs)
;
+ char *abs =
NULL
;
+ php_url *purl =
NULL
;
- STR_SET(abs, NULL);
+ if (url) {
+ purl = php_url_parse(abs = estrdup(url));
+ STR_SET(abs, NULL);
+ } else {
+ purl = ecalloc(1, sizeof(php_url));
+ }
if (purl) {
http_build_url(0, purl, NULL, NULL, &abs, NULL);
if (purl) {
http_build_url(0, purl, NULL, NULL, &abs, NULL);