]> granicus.if.org Git - php/commitdiff
check if write is allowed before writing to error log
authorStanislav Malyshev <stas@php.net>
Tue, 10 Jul 2007 17:42:29 +0000 (17:42 +0000)
committerStanislav Malyshev <stas@php.net>
Tue, 10 Jul 2007 17:42:29 +0000 (17:42 +0000)
main/main.c

index ad86c7ad15a495261dc0aa09dd9ecc45147ccfd9..ee70a04f88204a07433e3f6d9079ecd5af5cd675 100644 (file)
@@ -356,6 +356,14 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC)
                        return;
                }
 #endif
+               if (PG(safe_mode) && (!php_checkuid(PG(error_log), NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
+                       return FAILURE;
+               }
+
+               if (PG(open_basedir) && php_check_open_basedir(PG(error_log) TSRMLS_CC)) {
+                       return FAILURE;
+               }
+               
                fd = VCWD_OPEN_MODE(PG(error_log), O_CREAT | O_APPEND | O_WRONLY, 0644);
                if (fd != -1) {
                        char *tmp;