From: Ilia Alshanetsky Date: Mon, 20 Oct 2003 14:37:02 +0000 (+0000) Subject: MFH: Fixed bug #25918 (Possible crash in mime_content_type()). X-Git-Tag: php-4.3.4RC2~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=25679a60c73497ed5cdb156477da73c573532a70;p=php MFH: Fixed bug #25918 (Possible crash in mime_content_type()). --- diff --git a/NEWS b/NEWS index 25750b4df2..f155312ec4 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,7 @@ PHP 4 NEWS - Fixed multibyte regex engine to properly handle ".*" pattern under POSIX compatible mode. (K.Kosako , Moriyoshi) - Fixed bug #25923 (mail() modifies the to & subject arguments). (Ilia) +- Fixed bug #25918 (Possible crash in mime_content_type()). (Ilia) - Fixed bug #25895 (Incorrect detection of safe_mode limited ini options). (Ilia) - Fixed bug #25836 (last key of multi-dimensional array passed via GPC not diff --git a/ext/mime_magic/mime_magic.c b/ext/mime_magic/mime_magic.c index 6f44363e09..a4b3203b58 100644 --- a/ext/mime_magic/mime_magic.c +++ b/ext/mime_magic/mime_magic.c @@ -1848,9 +1848,8 @@ static int magic_rsl_get(char **content_type, char **content_encoding) } /* detect memory allocation errors */ - if (!content_type || - (state == rsl_encoding && !*content_encoding)) { - return MIME_MAGIC_ERROR; + if (!content_type || !(*content_type) || (state == rsl_encoding && !*content_encoding)) { + return MIME_MAGIC_ERROR; } /* success! */