@@ -3268,13 +3268,6 @@ PHP_FUNCTION(mb_decode_numericentity)
3268
3268
continue; \
3269
3269
}
3270
3270
3271
- #define MAIL_ASCIIZ_CHECK_MBSTRING (str , len ) \
3272
- pp = str; \
3273
- ee = pp + len; \
3274
- while ((pp = memchr(pp, '\0', (ee - pp)))) { \
3275
- *pp = ' '; \
3276
- } \
3277
-
3278
3271
static int _php_mbstr_parse_mail_headers (HashTable * ht , const char * str , size_t str_len )
3279
3272
{
3280
3273
const char * ps ;
@@ -3451,7 +3444,7 @@ PHP_FUNCTION(mb_send_mail)
3451
3444
size_t subject_len ;
3452
3445
zend_string * extra_cmd = NULL ;
3453
3446
HashTable * headers_ht = NULL ;
3454
- zend_string * str_headers = NULL , * tmp_headers ;
3447
+ zend_string * str_headers = NULL ;
3455
3448
size_t n , i ;
3456
3449
char * to_r = NULL ;
3457
3450
char * force_extra_parameters = INI_STR ("mail.force_extra_parameters" );
@@ -3473,7 +3466,6 @@ PHP_FUNCTION(mb_send_mail)
3473
3466
HashTable ht_headers ;
3474
3467
zval * s ;
3475
3468
extern void mbfl_memory_device_unput (mbfl_memory_device * device );
3476
- char * pp , * ee ;
3477
3469
3478
3470
/* initialize */
3479
3471
mbfl_memory_device_init (& device , 0 , 0 );
@@ -3492,32 +3484,24 @@ PHP_FUNCTION(mb_send_mail)
3492
3484
}
3493
3485
3494
3486
ZEND_PARSE_PARAMETERS_START (3 , 5 )
3495
- Z_PARAM_STRING (to , to_len )
3496
- Z_PARAM_STRING (subject , subject_len )
3497
- Z_PARAM_STRING (message , message_len )
3487
+ Z_PARAM_PATH (to , to_len )
3488
+ Z_PARAM_PATH (subject , subject_len )
3489
+ Z_PARAM_PATH (message , message_len )
3498
3490
Z_PARAM_OPTIONAL
3499
3491
Z_PARAM_STR_OR_ARRAY_HT_OR_NULL (str_headers , headers_ht )
3500
- Z_PARAM_STR_OR_NULL (extra_cmd )
3492
+ Z_PARAM_PATH_STR_OR_NULL (extra_cmd )
3501
3493
ZEND_PARSE_PARAMETERS_END ();
3502
3494
3503
- /* ASCIIZ check */
3504
- MAIL_ASCIIZ_CHECK_MBSTRING (to , to_len );
3505
- MAIL_ASCIIZ_CHECK_MBSTRING (subject , subject_len );
3506
- MAIL_ASCIIZ_CHECK_MBSTRING (message , message_len ) ;
3507
-
3508
3495
if (str_headers ) {
3509
- tmp_headers = zend_string_init (ZSTR_VAL (str_headers ), ZSTR_LEN (str_headers ), 0 );
3510
- MAIL_ASCIIZ_CHECK_MBSTRING (ZSTR_VAL (tmp_headers ), ZSTR_LEN (tmp_headers ));
3511
- str_headers = php_trim (tmp_headers , NULL , 0 , 2 );
3512
- zend_string_release_ex (tmp_headers , 0 );
3496
+ if (strlen (ZSTR_VAL (str_headers )) != ZSTR_LEN (str_headers )) {
3497
+ zend_argument_value_error (4 , "must not contain any null bytes" );
3498
+ RETURN_THROWS ();
3499
+ }
3500
+ str_headers = php_trim (str_headers , NULL , 0 , 2 );
3513
3501
} else if (headers_ht ) {
3514
3502
str_headers = php_mail_build_headers (headers_ht );
3515
3503
}
3516
3504
3517
- if (extra_cmd ) {
3518
- MAIL_ASCIIZ_CHECK_MBSTRING (ZSTR_VAL (extra_cmd ), ZSTR_LEN (extra_cmd ));
3519
- }
3520
-
3521
3505
zend_hash_init (& ht_headers , 0 , NULL , ZVAL_PTR_DTOR , 0 );
3522
3506
3523
3507
if (str_headers != NULL ) {
0 commit comments