From 289402edc6e66c6fdb6deb9cc71e7cf550f35196 Mon Sep 17 00:00:00 2001 From: foobar Date: Tue, 1 Nov 2005 17:05:09 +0000 Subject: MFH: - Added missing safe-mode checks # Added by replacing the existing open_basedir checks with a macro # Also, the filename passed might be null, etc. so it's not very good # idea to pass to php_error_docref() (catch by Ilia) --- ext/gd/php_gd.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'ext/gd/php_gd.h') diff --git a/ext/gd/php_gd.h b/ext/gd/php_gd.h index cc011b75b7..80781691de 100644 --- a/ext/gd/php_gd.h +++ b/ext/gd/php_gd.h @@ -30,6 +30,15 @@ #if HAVE_LIBGD +/* open_basedir and safe_mode checks */ +#define PHP_GD_CHECK_OPEN_BASEDIR(filename, errormsg) \ + if (!filename || php_check_open_basedir(filename TSRMLS_CC) || \ + (PG(safe_mode) && !php_checkuid(filename, "rb+", CHECKUID_CHECK_FILE_AND_DIR)) \ + ) { \ + php_error_docref(NULL TSRMLS_CC, E_WARNING, errormsg); \ + RETURN_FALSE; \ + } + #define PHP_GDIMG_TYPE_GIF 1 #define PHP_GDIMG_TYPE_PNG 2 #define PHP_GDIMG_TYPE_JPG 3 -- cgit v1.2.1