@@ -614,6 +614,10 @@ PHPAPI void (*php_internal_encoding_changed)(void) = NULL;
614614 */
615615static PHP_INI_MH (OnUpdateDefaultCharset )
616616{
617+ if (memchr (ZSTR_VAL (new_value ), '\0' , ZSTR_LEN (new_value ))
618+ || strpbrk (ZSTR_VAL (new_value ), "\r\n" )) {
619+ return FAILURE ;
620+ }
617621 OnUpdateString (entry , new_value , mh_arg1 , mh_arg2 , mh_arg3 , stage );
618622 if (php_internal_encoding_changed ) {
619623 php_internal_encoding_changed ();
@@ -627,6 +631,18 @@ static PHP_INI_MH(OnUpdateDefaultCharset)
627631}
628632/* }}} */
629633
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+
630646/* {{{ PHP_INI_MH
631647 */
632648static PHP_INI_MH (OnUpdateInternalEncoding )
@@ -782,7 +798,7 @@ PHP_INI_BEGIN()
782798 STD_PHP_INI_ENTRY ("auto_prepend_file" , NULL , PHP_INI_SYSTEM |PHP_INI_PERDIR , OnUpdateString , auto_prepend_file , php_core_globals , core_globals )
783799 STD_PHP_INI_ENTRY ("doc_root" , NULL , PHP_INI_SYSTEM , OnUpdateStringUnempty , doc_root , php_core_globals , core_globals )
784800 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 )
786802 STD_PHP_INI_ENTRY ("internal_encoding" , NULL , PHP_INI_ALL , OnUpdateInternalEncoding , internal_encoding , php_core_globals , core_globals )
787803 STD_PHP_INI_ENTRY ("input_encoding" , NULL , PHP_INI_ALL , OnUpdateInputEncoding , input_encoding , php_core_globals , core_globals )
788804 STD_PHP_INI_ENTRY ("output_encoding" , NULL , PHP_INI_ALL , OnUpdateOutputEncoding , output_encoding , php_core_globals , core_globals )
0 commit comments