Skip to content

3 minor cleanups in ext/session #10722

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions ext/session/mod_files.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,10 +674,8 @@ PS_CREATE_SID_FUNC(files)
/* Check collision */
/* FIXME: mod_data(data) should not be NULL (User handler could be NULL) */
if (data && ps_files_key_exists(data, sid) == SUCCESS) {
if (sid) {
zend_string_release_ex(sid, 0);
sid = NULL;
}
zend_string_release_ex(sid, 0);
sid = NULL;
if (--maxfail < 0) {
return NULL;
}
Expand Down
7 changes: 3 additions & 4 deletions ext/session/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -904,10 +904,9 @@ PS_SERIALIZER_DECODE_FUNC(php_binary) /* {{{ */
PHP_VAR_UNSERIALIZE_INIT(var_hash);

for (p = val; p < endptr; ) {
// Can this be changed to size_t?
int namelen = ((unsigned char)(*p)) & (~PS_BIN_UNDEF);
size_t namelen = ((unsigned char)(*p)) & (~PS_BIN_UNDEF);

if (namelen < 0 || namelen > PS_BIN_MAX || (p + namelen) >= endptr) {
if (namelen > PS_BIN_MAX || (p + namelen) >= endptr) {
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
return FAILURE;
}
Expand Down Expand Up @@ -2910,7 +2909,7 @@ static PHP_MINFO_FUNCTION(session) /* {{{ */

/* Get serializer handlers */
for (i = 0, ser = ps_serializers; i < MAX_SERIALIZERS; i++, ser++) {
if (ser && ser->name) {
if (ser->name) {
smart_str_appends(&ser_handlers, ser->name);
smart_str_appendc(&ser_handlers, ' ');
}
Expand Down