@@ -3890,7 +3890,7 @@ static int _php_mbstr_parse_mail_headers(HashTable *ht, const char *str, size_t
3890
3890
size_t icnt ;
3891
3891
int state = 0 ;
3892
3892
int crlf_state = -1 ;
3893
- char * token ;
3893
+ char * token = NULL ;
3894
3894
size_t token_pos ;
3895
3895
zend_string * fld_name , * fld_val ;
3896
3896
@@ -3917,8 +3917,9 @@ static int _php_mbstr_parse_mail_headers(HashTable *ht, const char *str, size_t
3917
3917
}
3918
3918
3919
3919
if (state == 0 || state == 1 ) {
3920
- fld_name = zend_string_init (token , token_pos , 0 );
3921
-
3920
+ if (token ) {
3921
+ fld_name = zend_string_init (token , token_pos , 0 );
3922
+ }
3922
3923
state = 2 ;
3923
3924
} else {
3924
3925
token_pos ++ ;
@@ -3982,7 +3983,9 @@ static int _php_mbstr_parse_mail_headers(HashTable *ht, const char *str, size_t
3982
3983
3983
3984
case 3 :
3984
3985
if (crlf_state == -1 ) {
3985
- fld_val = zend_string_init (token , token_pos , 0 );
3986
+ if (token ) {
3987
+ fld_val = zend_string_init (token , token_pos , 0 );
3988
+ }
3986
3989
3987
3990
if (fld_name != NULL && fld_val != NULL ) {
3988
3991
zval val ;
@@ -4029,8 +4032,9 @@ static int _php_mbstr_parse_mail_headers(HashTable *ht, const char *str, size_t
4029
4032
state = 3 ;
4030
4033
}
4031
4034
if (state == 3 ) {
4032
- fld_val = zend_string_init (token , 0 , 0 );
4033
-
4035
+ if (token ) {
4036
+ fld_val = zend_string_init (token , token_pos , 0 );
4037
+ }
4034
4038
if (fld_name != NULL && fld_val != NULL ) {
4035
4039
zval val ;
4036
4040
/* FIXME: some locale free implementation is
0 commit comments