@@ -93,6 +93,8 @@ zend_class_entry *php_session_update_timestamp_iface_entry;
93
93
return FAILURE; \
94
94
}
95
95
96
+ #define SESSION_FORBIDDEN_CHARS "=,;.[ \t\r\n\013\014"
97
+
96
98
#define APPLY_TRANS_SID (PS(use_trans_sid) && !PS(use_only_cookies))
97
99
98
100
static int php_session_send_cookie (void );
@@ -1254,7 +1256,7 @@ static void php_session_remove_cookie(void) {
1254
1256
size_t session_cookie_len ;
1255
1257
size_t len = sizeof ("Set-Cookie" )- 1 ;
1256
1258
1257
- ZEND_ASSERT (strpbrk (PS (session_name ), "=,; \t\r\n\013\014" ) == NULL );
1259
+ ZEND_ASSERT (strpbrk (PS (session_name ), SESSION_FORBIDDEN_CHARS ) == NULL );
1258
1260
spprintf (& session_cookie , 0 , "Set-Cookie: %s=" , PS (session_name ));
1259
1261
1260
1262
session_cookie_len = strlen (session_cookie );
@@ -1302,8 +1304,8 @@ static zend_result php_session_send_cookie(void) /* {{{ */
1302
1304
}
1303
1305
1304
1306
/* Prevent broken Set-Cookie header, because the session_name might be user supplied */
1305
- if (strpbrk (PS (session_name ), "=,; \t\r\n\013\014" ) != NULL ) { /* man isspace for \013 and \014 */
1306
- php_error_docref (NULL , E_WARNING , "session.name cannot contain any of the following '=,; \\t\\r\\n\\013\\014'" );
1307
+ if (strpbrk (PS (session_name ), SESSION_FORBIDDEN_CHARS ) != NULL ) { /* man isspace for \013 and \014 */
1308
+ php_error_docref (NULL , E_WARNING , "session.name cannot contain any of the following '=,;.[ \\t\\r\\n\\013\\014'" );
1307
1309
return FAILURE ;
1308
1310
}
1309
1311
0 commit comments