@@ -94,6 +94,8 @@ zend_class_entry *php_session_update_timestamp_iface_entry;
94
94
return FAILURE; \
95
95
}
96
96
97
+ #define SESSION_FORBIDDEN_CHARS "=,;.[ \t\r\n\013\014"
98
+
97
99
#define APPLY_TRANS_SID (PS(use_trans_sid) && !PS(use_only_cookies))
98
100
99
101
static int php_session_send_cookie (void );
@@ -1268,7 +1270,7 @@ static void php_session_remove_cookie(void) {
1268
1270
size_t session_cookie_len ;
1269
1271
size_t len = sizeof ("Set-Cookie" )- 1 ;
1270
1272
1271
- ZEND_ASSERT (strpbrk (PS (session_name ), "=,; \t\r\n\013\014" ) == NULL );
1273
+ ZEND_ASSERT (strpbrk (PS (session_name ), SESSION_FORBIDDEN_CHARS ) == NULL );
1272
1274
spprintf (& session_cookie , 0 , "Set-Cookie: %s=" , PS (session_name ));
1273
1275
1274
1276
session_cookie_len = strlen (session_cookie );
@@ -1316,8 +1318,8 @@ static int php_session_send_cookie(void) /* {{{ */
1316
1318
}
1317
1319
1318
1320
/* Prevent broken Set-Cookie header, because the session_name might be user supplied */
1319
- if (strpbrk (PS (session_name ), "=,; \t\r\n\013\014" ) != NULL ) { /* man isspace for \013 and \014 */
1320
- php_error_docref (NULL , E_WARNING , "session.name cannot contain any of the following '=,; \\t\\r\\n\\013\\014'" );
1321
+ if (strpbrk (PS (session_name ), SESSION_FORBIDDEN_CHARS ) != NULL ) { /* man isspace for \013 and \014 */
1322
+ php_error_docref (NULL , E_WARNING , "session.name cannot contain any of the following '=,;.[ \\t\\r\\n\\013\\014'" );
1321
1323
return FAILURE ;
1322
1324
}
1323
1325
0 commit comments