mirror of
https://github.com/php/php-src.git
synced 2026-04-28 02:33:17 +02:00
Fixed bug #50219 (soap call Segmentation fault on a redirected url).
This commit is contained in:
+14
-6
@@ -996,12 +996,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;
|
||||
|
||||
Reference in New Issue
Block a user