summaryrefslogtreecommitdiff
path: root/ext/soap/php_http.c
diff options
context:
space:
mode:
authorPierrick Charron <pierrick@php.net>2009-11-21 01:22:32 +0000
committerPierrick Charron <pierrick@php.net>2009-11-21 01:22:32 +0000
commit84ab9cd30e7e8a89b658e0c893c1377d066a335c (patch)
treedf6b43fa750ebf3098bea8ac1f6ec65e4b02bfc3 /ext/soap/php_http.c
parente53f363548e769a57d58ec6b5848201268052b20 (diff)
downloadphp-git-84ab9cd30e7e8a89b658e0c893c1377d066a335c.tar.gz
Fixed bug #50219 (soap call Segmentation fault on a redirected url).
Diffstat (limited to 'ext/soap/php_http.c')
-rw-r--r--ext/soap/php_http.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c
index 563087a31d..f0b00dc6d1 100644
--- a/ext/soap/php_http.c
+++ b/ext/soap/php_http.c
@@ -990,12 +990,20 @@ try_again:
new_url->host = phpurl->host ? estrdup(phpurl->host) : NULL;
new_url->port = phpurl->port;
if (new_url->path && new_url->path[0] != '/') {
- char *t = phpurl->path;
- char *p = strrchr(t, '/');
- if (p) {
- char *s = emalloc((p - t) + strlen(new_url->path) + 2);
- strncpy(s, t, (p - t) + 1);
- s[(p - t) + 1] = 0;
+ if (phpurl->path) {
+ char *t = phpurl->path;
+ char *p = strrchr(t, '/');
+ if (p) {
+ char *s = emalloc((p - t) + strlen(new_url->path) + 2);
+ strncpy(s, t, (p - t) + 1);
+ s[(p - t) + 1] = 0;
+ strcat(s, new_url->path);
+ efree(new_url->path);
+ new_url->path = s;
+ }
+ } else {
+ char *s = emalloc(strlen(new_url->path) + 2);
+ s[0] = '/'; s[1] = 0;
strcat(s, new_url->path);
efree(new_url->path);
new_url->path = s;