iliaa Thu Feb 15 00:05:42 2007 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/mime_magic mime_magic.c
Log:
Fixed a possible memory corruption inside mime_content_type() on a
non-existent file.
http://cvs.php.net/viewvc.cgi/php-src/ext/mime_magic/mime_magic.c?r1=1.42.2.5.2.5&r2=1.42.2.5.2.6&diff_format=u
Index: php-src/ext/mime_magic/mime_magic.c
diff -u php-src/ext/mime_magic/mime_magic.c:1.42.2.5.2.5
php-src/ext/mime_magic/mime_magic.c:1.42.2.5.2.6
--- php-src/ext/mime_magic/mime_magic.c:1.42.2.5.2.5 Mon Jan 1 09:36:03 2007
+++ php-src/ext/mime_magic/mime_magic.c Thu Feb 15 00:05:42 2007
@@ -15,7 +15,7 @@
| Author: Hartmut Holzgraefe <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
- $Id: mime_magic.c,v 1.42.2.5.2.5 2007/01/01 09:36:03 sebastian Exp $
+ $Id: mime_magic.c,v 1.42.2.5.2.6 2007/02/15 00:05:42 iliaa Exp $
This module contains a lot of stuff taken from Apache mod_mime_magic,
so the license section is a little bit longer than usual:
@@ -1156,21 +1156,29 @@
php_stream_statbuf stat_ssb;
switch (Z_TYPE_P(what)) {
- case IS_STRING:
- if(!php_stream_stat_path(Z_STRVAL_P(what), &stat_ssb)) {
- return MIME_MAGIC_OK;
- }
- break;
- case IS_RESOURCE:
- {
- php_stream *stream;
-
- php_stream_from_zval_no_verify(stream, &what);
- if(!php_stream_stat(stream, &stat_ssb)) {
- return MIME_MAGIC_OK;
+ case IS_STRING:
+ if (php_stream_stat_path_ex(Z_STRVAL_P(what),
PHP_STREAM_URL_STAT_QUIET, &stat_ssb, NULL)) {
+ if (MIME_MAGIC_G(debug)) {
+ php_error_docref(NULL TSRMLS_CC,
E_WARNING, "Non-statable file path (%s)", Z_STRVAL_P(what));
+ }
+ return MIME_MAGIC_ERROR;
}
- }
- break;
+ break;
+ case IS_RESOURCE:
+ {
+ php_stream *stream;
+
+ php_stream_from_zval_no_verify(stream, &what);
+ if (php_stream_stat(stream, &stat_ssb)) {
+ if (MIME_MAGIC_G(debug)) {
+ php_error_docref(NULL
TSRMLS_CC, E_WARNING, "Non-statable file path (%s)", Z_STRVAL_P(what));
+ }
+ return MIME_MAGIC_ERROR;
+ }
+ }
+ break;
+ default:
+ return MIME_MAGIC_OK;
}
switch (stat_ssb.sb.st_mode & S_IFMT) {
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php