From: Ilia Alshanetsky Date: Fri, 4 Aug 2006 20:32:44 +0000 (+0000) Subject: MFB: Fixed bug #37265 (Added missing safe_mode & open_basedir checks to X-Git-Tag: php-4.4.4RC1~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bed700e088ecdd44de2849b1e00bddb61f426122;p=php MFB: Fixed bug #37265 (Added missing safe_mode & open_basedir checks to imap_body()). --- diff --git a/NEWS b/NEWS index bdba7c0fb4..713b739d75 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,8 @@ PHP 4 NEWS - Fixed bug #38183 (disable_classes=Foobar causes disabled class to be called Foo). (Jani) - Fixed bug #38112 (corrupted gif segfaults) (Pierre) +- Fixed bug #37265 (Added missing safe_mode & open_basedir checks to + imap_body()). (Ilia) - Fixed bug #29538 (number_format and problem with 0). (Matthew Wilmas) 03 Aug 2006, Version 4.4.3 diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index b1a9f94784..3e30d79ebb 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -731,6 +731,13 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) efree(IMAPG(imap_password)); } + /* local filename, need to perform open_basedir and safe_mode checks */ + if (Z_STRVAL_PP(mailbox)[0] != '{' && + (php_check_open_basedir(Z_STRVAL_PP(mailbox) TSRMLS_CC) || + (PG(safe_mode) && !php_checkuid(Z_STRVAL_PP(mailbox), NULL, CHECKUID_CHECK_FILE_AND_DIR)))) { + RETURN_FALSE; + } + IMAPG(imap_user) = estrndup(Z_STRVAL_PP(user), Z_STRLEN_PP(user)); IMAPG(imap_password) = estrndup(Z_STRVAL_PP(passwd), Z_STRLEN_PP(passwd));