@@ -538,6 +538,10 @@ PHPAPI void (*php_internal_encoding_changed)(void) = NULL;
538
538
/* {{{ PHP_INI_MH */
539
539
static PHP_INI_MH (OnUpdateDefaultCharset )
540
540
{
541
+ if (memchr (ZSTR_VAL (new_value ), '\0' , ZSTR_LEN (new_value ))
542
+ || strpbrk (ZSTR_VAL (new_value ), "\r\n" )) {
543
+ return FAILURE ;
544
+ }
541
545
OnUpdateString (entry , new_value , mh_arg1 , mh_arg2 , mh_arg3 , stage );
542
546
if (php_internal_encoding_changed ) {
543
547
php_internal_encoding_changed ();
@@ -551,6 +555,17 @@ static PHP_INI_MH(OnUpdateDefaultCharset)
551
555
}
552
556
/* }}} */
553
557
558
+ /* {{{ PHP_INI_MH */
559
+ static PHP_INI_MH (OnUpdateDefaultMimeTye )
560
+ {
561
+ if (memchr (ZSTR_VAL (new_value ), '\0' , ZSTR_LEN (new_value ))
562
+ || strpbrk (ZSTR_VAL (new_value ), "\r\n" )) {
563
+ return FAILURE ;
564
+ }
565
+ return OnUpdateString (entry , new_value , mh_arg1 , mh_arg2 , mh_arg3 , stage );
566
+ }
567
+ /* }}} */
568
+
554
569
/* {{{ PHP_INI_MH */
555
570
static PHP_INI_MH (OnUpdateInternalEncoding )
556
571
{
@@ -698,7 +713,7 @@ PHP_INI_BEGIN()
698
713
STD_PHP_INI_ENTRY ("auto_prepend_file" , NULL , PHP_INI_SYSTEM |PHP_INI_PERDIR , OnUpdateString , auto_prepend_file , php_core_globals , core_globals )
699
714
STD_PHP_INI_ENTRY ("doc_root" , NULL , PHP_INI_SYSTEM , OnUpdateStringUnempty , doc_root , php_core_globals , core_globals )
700
715
STD_PHP_INI_ENTRY ("default_charset" , PHP_DEFAULT_CHARSET , PHP_INI_ALL , OnUpdateDefaultCharset , default_charset , sapi_globals_struct , sapi_globals )
701
- STD_PHP_INI_ENTRY ("default_mimetype" , SAPI_DEFAULT_MIMETYPE , PHP_INI_ALL , OnUpdateString , default_mimetype , sapi_globals_struct , sapi_globals )
716
+ STD_PHP_INI_ENTRY ("default_mimetype" , SAPI_DEFAULT_MIMETYPE , PHP_INI_ALL , OnUpdateDefaultMimeTye , default_mimetype , sapi_globals_struct , sapi_globals )
702
717
STD_PHP_INI_ENTRY ("internal_encoding" , NULL , PHP_INI_ALL , OnUpdateInternalEncoding , internal_encoding , php_core_globals , core_globals )
703
718
STD_PHP_INI_ENTRY ("input_encoding" , NULL , PHP_INI_ALL , OnUpdateInputEncoding , input_encoding , php_core_globals , core_globals )
704
719
STD_PHP_INI_ENTRY ("output_encoding" , NULL , PHP_INI_ALL , OnUpdateOutputEncoding , output_encoding , php_core_globals , core_globals )
0 commit comments