Skip to content

Conversation

@jorgsowa
Copy link
Contributor

@jorgsowa jorgsowa commented Aug 7, 2024

Prevents setting session name with null byte through the session_name() function.

@jorgsowa jorgsowa requested a review from Girgias as a code owner August 7, 2024 23:00
@jorgsowa jorgsowa marked this pull request as draft August 8, 2024 07:54
@cmb69
Copy link
Member

cmb69 commented Aug 10, 2024

Can't we just apply the following patch instead:

 ext/session/session.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ext/session/session.c b/ext/session/session.c
index f3296e37f2..c69409fdb4 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -1865,7 +1865,7 @@ PHP_FUNCTION(session_name)
 	zend_string *name = NULL;
 	zend_string *ini_name;
 
-	if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S!", &name) == FAILURE) {
+	if (zend_parse_parameters(ZEND_NUM_ARGS(), "|P!", &name) == FAILURE) {
 		RETURN_THROWS();
 	}

@jorgsowa
Copy link
Contributor Author

Thanks for the comment. I limited only to flag P of session_name()'s input.

@jorgsowa jorgsowa marked this pull request as ready for review August 10, 2024 23:09
Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with minor nit

@Girgias Girgias merged commit 6bf7b72 into php:master Aug 11, 2024
@Girgias
Copy link
Member

Girgias commented Aug 11, 2024

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants