pierrick                                 Sat, 21 Nov 2009 01:22:32 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=291104

Log:
Fixed bug #50219 (soap call Segmentation fault on a redirected url).

Bug: http://bugs.php.net/50219 (Open) soap call Segmentation fault on a 
redirected url
      
Changed paths:
    U   php/php-src/branches/PHP_5_2/NEWS
    U   php/php-src/branches/PHP_5_2/ext/soap/php_http.c
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/soap/php_http.c
    U   php/php-src/trunk/ext/soap/php_http.c

Modified: php/php-src/branches/PHP_5_2/NEWS
===================================================================
--- php/php-src/branches/PHP_5_2/NEWS   2009-11-21 00:34:37 UTC (rev 291103)
+++ php/php-src/branches/PHP_5_2/NEWS   2009-11-21 01:22:32 UTC (rev 291104)
@@ -6,6 +6,8 @@
 - Changed "post_max_size" php.ini directive to allow unlimited post size by
   setting it to 0. (Rasmus)

+- Fixed bug #50219 (soap call Segmentation fault on a redirected url).
+  (Pierrick)
 - Fixed bug #50207 (segmentation fault when concatenating very large strings
   on 64bit linux). (Ilia)
 - Fixed bug #50185 (ldap_get_entries() return false instead of an empty array

Modified: php/php-src/branches/PHP_5_2/ext/soap/php_http.c
===================================================================
--- php/php-src/branches/PHP_5_2/ext/soap/php_http.c    2009-11-21 00:34:37 UTC 
(rev 291103)
+++ php/php-src/branches/PHP_5_2/ext/soap/php_http.c    2009-11-21 01:22:32 UTC 
(rev 291104)
@@ -931,12 +931,20 @@
                                        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;

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2009-11-21 00:34:37 UTC (rev 291103)
+++ php/php-src/branches/PHP_5_3/NEWS   2009-11-21 01:22:32 UTC (rev 291104)
@@ -24,6 +24,8 @@
   (Pierre)


+- Fixed bug #50219 (soap call Segmentation fault on a redirected url).
+  (Pierrick)
 - Fixed bug #50212 (crash by ldap_get_option() with LDAP_OPT_NETWORK_TIMEOUT).
   (Ilia, shigeru_kitazaki at cybozu dot co dot jp)
 - Fixed bug #50207 (segmentation fault when concatenating very large strings on

Modified: php/php-src/branches/PHP_5_3/ext/soap/php_http.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/soap/php_http.c    2009-11-21 00:34:37 UTC 
(rev 291103)
+++ php/php-src/branches/PHP_5_3/ext/soap/php_http.c    2009-11-21 01:22:32 UTC 
(rev 291104)
@@ -990,12 +990,20 @@
                                        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;

Modified: php/php-src/trunk/ext/soap/php_http.c
===================================================================
--- php/php-src/trunk/ext/soap/php_http.c       2009-11-21 00:34:37 UTC (rev 
291103)
+++ php/php-src/trunk/ext/soap/php_http.c       2009-11-21 01:22:32 UTC (rev 
291104)
@@ -996,12 +996,20 @@
                                        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;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to