summaryrefslogtreecommitdiff
path: root/ext/gd/php_gd.h
diff options
context:
space:
mode:
authorfoobar <sniper@php.net>2005-11-01 17:05:09 +0000
committerfoobar <sniper@php.net>2005-11-01 17:05:09 +0000
commit289402edc6e66c6fdb6deb9cc71e7cf550f35196 (patch)
tree106512fa42f7e7a67b56f24eb5caa46a9379ea33 /ext/gd/php_gd.h
parent98691ba0c09b84f7091a3d517e24942ab013f44e (diff)
downloadphp-git-289402edc6e66c6fdb6deb9cc71e7cf550f35196.tar.gz
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)
Diffstat (limited to 'ext/gd/php_gd.h')
-rw-r--r--ext/gd/php_gd.h9
1 files changed, 9 insertions, 0 deletions
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