@@ -614,6 +614,10 @@ PHPAPI void (*php_internal_encoding_changed)(void) = NULL;
614
614
*/
615
615
static PHP_INI_MH (OnUpdateDefaultCharset )
616
616
{
617
+ if (memchr (ZSTR_VAL (new_value ), '\0' , ZSTR_LEN (new_value ))
618
+ || strpbrk (ZSTR_VAL (new_value ), "\r\n" )) {
619
+ return FAILURE ;
620
+ }
617
621
OnUpdateString (entry , new_value , mh_arg1 , mh_arg2 , mh_arg3 , stage );
618
622
if (php_internal_encoding_changed ) {
619
623
php_internal_encoding_changed ();
@@ -627,6 +631,18 @@ static PHP_INI_MH(OnUpdateDefaultCharset)
627
631
}
628
632
/* }}} */
629
633
634
+ /* {{{ PHP_INI_MH
635
+ */
636
+ static PHP_INI_MH (OnUpdateDefaultMimeTye )
637
+ {
638
+ if (memchr (ZSTR_VAL (new_value ), '\0' , ZSTR_LEN (new_value ))
639
+ || strpbrk (ZSTR_VAL (new_value ), "\r\n" )) {
640
+ return FAILURE ;
641
+ }
642
+ return OnUpdateString (entry , new_value , mh_arg1 , mh_arg2 , mh_arg3 , stage );
643
+ }
644
+ /* }}} */
645
+
630
646
/* {{{ PHP_INI_MH
631
647
*/
632
648
static PHP_INI_MH (OnUpdateInternalEncoding )
@@ -782,7 +798,7 @@ PHP_INI_BEGIN()
782
798
STD_PHP_INI_ENTRY ("auto_prepend_file" , NULL , PHP_INI_SYSTEM |PHP_INI_PERDIR , OnUpdateString , auto_prepend_file , php_core_globals , core_globals )
783
799
STD_PHP_INI_ENTRY ("doc_root" , NULL , PHP_INI_SYSTEM , OnUpdateStringUnempty , doc_root , php_core_globals , core_globals )
784
800
STD_PHP_INI_ENTRY ("default_charset" , PHP_DEFAULT_CHARSET , PHP_INI_ALL , OnUpdateDefaultCharset , default_charset , sapi_globals_struct , sapi_globals )
785
- STD_PHP_INI_ENTRY ("default_mimetype" , SAPI_DEFAULT_MIMETYPE , PHP_INI_ALL , OnUpdateString , default_mimetype , sapi_globals_struct , sapi_globals )
801
+ STD_PHP_INI_ENTRY ("default_mimetype" , SAPI_DEFAULT_MIMETYPE , PHP_INI_ALL , OnUpdateDefaultMimeTye , default_mimetype , sapi_globals_struct , sapi_globals )
786
802
STD_PHP_INI_ENTRY ("internal_encoding" , NULL , PHP_INI_ALL , OnUpdateInternalEncoding , internal_encoding , php_core_globals , core_globals )
787
803
STD_PHP_INI_ENTRY ("input_encoding" , NULL , PHP_INI_ALL , OnUpdateInputEncoding , input_encoding , php_core_globals , core_globals )
788
804
STD_PHP_INI_ENTRY ("output_encoding" , NULL , PHP_INI_ALL , OnUpdateOutputEncoding , output_encoding , php_core_globals , core_globals )
0 commit comments