@@ -533,6 +533,10 @@ PHPAPI void (*php_internal_encoding_changed)(void) = NULL;
533
533
/* {{{ PHP_INI_MH */
534
534
static PHP_INI_MH (OnUpdateDefaultCharset )
535
535
{
536
+ if (memchr (ZSTR_VAL (new_value ), '\0' , ZSTR_LEN (new_value ))
537
+ || strpbrk (ZSTR_VAL (new_value ), "\r\n" )) {
538
+ return FAILURE ;
539
+ }
536
540
OnUpdateString (entry , new_value , mh_arg1 , mh_arg2 , mh_arg3 , stage );
537
541
if (php_internal_encoding_changed ) {
538
542
php_internal_encoding_changed ();
@@ -546,6 +550,17 @@ static PHP_INI_MH(OnUpdateDefaultCharset)
546
550
}
547
551
/* }}} */
548
552
553
+ /* {{{ PHP_INI_MH */
554
+ static PHP_INI_MH (OnUpdateDefaultMimeTye )
555
+ {
556
+ if (memchr (ZSTR_VAL (new_value ), '\0' , ZSTR_LEN (new_value ))
557
+ || strpbrk (ZSTR_VAL (new_value ), "\r\n" )) {
558
+ return FAILURE ;
559
+ }
560
+ return OnUpdateString (entry , new_value , mh_arg1 , mh_arg2 , mh_arg3 , stage );
561
+ }
562
+ /* }}} */
563
+
549
564
/* {{{ PHP_INI_MH */
550
565
static PHP_INI_MH (OnUpdateInternalEncoding )
551
566
{
@@ -693,7 +708,7 @@ PHP_INI_BEGIN()
693
708
STD_PHP_INI_ENTRY ("auto_prepend_file" , NULL , PHP_INI_SYSTEM |PHP_INI_PERDIR , OnUpdateString , auto_prepend_file , php_core_globals , core_globals )
694
709
STD_PHP_INI_ENTRY ("doc_root" , NULL , PHP_INI_SYSTEM , OnUpdateStringUnempty , doc_root , php_core_globals , core_globals )
695
710
STD_PHP_INI_ENTRY ("default_charset" , PHP_DEFAULT_CHARSET , PHP_INI_ALL , OnUpdateDefaultCharset , default_charset , sapi_globals_struct , sapi_globals )
696
- STD_PHP_INI_ENTRY ("default_mimetype" , SAPI_DEFAULT_MIMETYPE , PHP_INI_ALL , OnUpdateString , default_mimetype , sapi_globals_struct , sapi_globals )
711
+ STD_PHP_INI_ENTRY ("default_mimetype" , SAPI_DEFAULT_MIMETYPE , PHP_INI_ALL , OnUpdateDefaultMimeTye , default_mimetype , sapi_globals_struct , sapi_globals )
697
712
STD_PHP_INI_ENTRY ("internal_encoding" , NULL , PHP_INI_ALL , OnUpdateInternalEncoding , internal_encoding , php_core_globals , core_globals )
698
713
STD_PHP_INI_ENTRY ("input_encoding" , NULL , PHP_INI_ALL , OnUpdateInputEncoding , input_encoding , php_core_globals , core_globals )
699
714
STD_PHP_INI_ENTRY ("output_encoding" , NULL , PHP_INI_ALL , OnUpdateOutputEncoding , output_encoding , php_core_globals , core_globals )
0 commit comments