From: Nuno Lopes Date: Sat, 16 Sep 2006 18:15:25 +0000 (+0000) Subject: add missing checks around expand_filepath() X-Git-Tag: php-5.2.0RC5~148 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c7101ba6d2167555637ffb1f5009340a04c2334d;p=php add missing checks around expand_filepath() --- diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c index 05d1bb9a51..d5eca3d167 100644 --- a/ext/xmlreader/php_xmlreader.c +++ b/ext/xmlreader/php_xmlreader.c @@ -260,9 +260,8 @@ char *_xmlreader_get_valid_file_path(char *source, char *resolved_path, int reso file_dest = source; if ((uri->scheme == NULL || isFileUri)) { - /* XXX possible buffer overflow if VCWD_REALPATH does not know size of resolved_path */ - if (! VCWD_REALPATH(source, resolved_path)) { - expand_filepath(source, resolved_path TSRMLS_CC); + if (!VCWD_REALPATH(source, resolved_path) && !expand_filepath(source, resolved_path TSRMLS_CC)) { + return NULL; } file_dest = resolved_path; } diff --git a/ext/xmlwriter/php_xmlwriter.c b/ext/xmlwriter/php_xmlwriter.c index 5628b2c7a1..6baa512046 100644 --- a/ext/xmlwriter/php_xmlwriter.c +++ b/ext/xmlwriter/php_xmlwriter.c @@ -272,9 +272,8 @@ char *_xmlwriter_get_valid_file_path(char *source, char *resolved_path, int reso file_dest = source; if ((uri->scheme == NULL || isFileUri)) { - /* XXX possible buffer overflow if VCWD_REALPATH does not know size of resolved_path */ - if (! VCWD_REALPATH(source, resolved_path)) { - expand_filepath(source, resolved_path TSRMLS_CC); + if (!VCWD_REALPATH(source, resolved_path) && !expand_filepath(source, resolved_path TSRMLS_CC)) { + return NULL; } file_dest = resolved_path; }