]> granicus.if.org Git - php/commitdiff
- better fix for file:/// and file://localhost (thx Ilia), init file_dest when the...
authorPierre Joye <pajoye@php.net>
Mon, 25 May 2009 16:09:27 +0000 (16:09 +0000)
committerPierre Joye <pajoye@php.net>
Mon, 25 May 2009 16:09:27 +0000 (16:09 +0000)
ext/xmlwriter/php_xmlwriter.c

index c91b4d9254936e8786a666e45b80e476a44fbb0f..8e566654bdb063265c8591d3a3d2a4940432ebc7 100644 (file)
@@ -615,7 +615,7 @@ static char *_xmlwriter_get_valid_file_path(char *source, char *resolved_path, i
        if (uri->scheme != NULL) {
                /* absolute file uris - libxml only supports localhost or empty host */
                if (strncasecmp(source, "file:///", 8) == 0) {
-                       if (strlen(source) == 8) {
+                       if (source[sizeof("file:///") - 1] == '\0') {
                                return NULL;
                        }
                        isFileUri = 1;
@@ -625,7 +625,7 @@ static char *_xmlwriter_get_valid_file_path(char *source, char *resolved_path, i
                        source += 7;
 #endif
                } else if (strncasecmp(source, "file://localhost/",17) == 0) {
-                       if (strlen(source) == 17) {
+                       if (source[sizeof("file://localhost/") - 1] == '\0') {
                                return NULL;
                        }
 
@@ -659,6 +659,8 @@ static char *_xmlwriter_get_valid_file_path(char *source, char *resolved_path, i
                }
 
                file_dest = resolved_path;
+       } else {
+               file_dest = source;
        }
 
        xmlFreeURI(uri);