iliaa           Tue Feb 18 19:49:31 2003 EDT

  Modified files:              
    /php4/ext/standard  http_fopen_wrapper.c 
  Log:
  Fixed bug #22283 (possible crash when opening relative URLs).
  
  
Index: php4/ext/standard/http_fopen_wrapper.c
diff -u php4/ext/standard/http_fopen_wrapper.c:1.63 
php4/ext/standard/http_fopen_wrapper.c:1.64
--- php4/ext/standard/http_fopen_wrapper.c:1.63 Mon Feb 17 08:29:57 2003
+++ php4/ext/standard/http_fopen_wrapper.c      Tue Feb 18 19:49:31 2003
@@ -18,7 +18,7 @@
    |          Wez Furlong <[EMAIL PROTECTED]>                          |
    +----------------------------------------------------------------------+
  */
-/* $Id: http_fopen_wrapper.c,v 1.63 2003/02/17 13:29:57 zeev Exp $ */ 
+/* $Id: http_fopen_wrapper.c,v 1.64 2003/02/19 00:49:31 iliaa Exp $ */ 
 
 #include "php.h"
 #include "php_globals.h"
@@ -348,8 +348,13 @@
                        *new_path='\0';
                        if (strlen(location)<8 || (strncasecmp(location, "http://";, 
sizeof("http://";)-1) && strncasecmp(location, "https://";, sizeof("https://";)-1))) {
                                if (*location != '/') {
-                                       if (*(location+1) != '\0') {                   
         
-                                               php_dirname(resource->path, 
strlen(resource->path));
+                                       if (*(location+1) != '\0' && resource->path) { 
+         
+                                               char *s = strrchr(resource->path, '/');
+                                               if (!s) {
+                                                       s = resource->path;
+                                                       *s = '/';
+                                               }
+                                               s[1] = '\0'; 
                                                if (resource->path && 
*(resource->path) == '/' && *(resource->path + 1) == '\0') {
                                                        snprintf(loc_path, 
sizeof(loc_path) - 1, "%s%s", resource->path, location);
                                                } else {



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

Reply via email to