1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Remove session ID set through REQUEST_URI

This commit is contained in:
Ilija Tovilo
2023-06-17 22:49:53 +02:00
parent 466fc78d2c
commit f160eff441
2 changed files with 4 additions and 16 deletions

3
NEWS
View File

@@ -5,6 +5,9 @@ PHP NEWS
- PCRE:
. Mangle PCRE regex cache key with JIT option. (mvorisek)
- Session:
. Removed broken url support for transferring session ID. (ilutov)
06 Jul 2023, PHP 8.1.21
- CLI:

View File

@@ -1503,7 +1503,7 @@ PHPAPI int php_session_start(void) /* {{{ */
{
zval *ppid;
zval *data;
char *p, *value;
char *value;
size_t lensess;
switch (PS(session_status)) {
@@ -1572,21 +1572,6 @@ PHPAPI int php_session_start(void) /* {{{ */
ppid2sid(ppid);
}
}
/* Check the REQUEST_URI symbol for a string of the form
* '<session-name>=<session-id>' to allow URLs of the form
* http://yoursite/<session-name>=<session-id>/script.php */
if (!PS(id) && zend_is_auto_global(ZSTR_KNOWN(ZEND_STR_AUTOGLOBAL_SERVER)) == SUCCESS &&
(data = zend_hash_str_find(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), "REQUEST_URI", sizeof("REQUEST_URI") - 1)) &&
Z_TYPE_P(data) == IS_STRING &&
(p = strstr(Z_STRVAL_P(data), PS(session_name))) &&
p[lensess] == '='
) {
char *q;
p += lensess + 1;
if ((q = strpbrk(p, "/?\\"))) {
PS(id) = zend_string_init(p, q - p, 0);
}
}
/* Check whether the current request was referred to by
* an external site which invalidates the previously found id. */
if (PS(id) && PS(extern_referer_chk)[0] != '\0' &&