Skip to content

Improve socket cmsg space handling in sockets extension. #5387

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

Closed
wants to merge 1 commit into from

Conversation

Girgias
Copy link
Member

@Girgias Girgias commented Apr 14, 2020

This should also fix the null pointer arithmetic warning on MacOS as we don't depend on whack code written by Apple.

@nikic mind having a look at this?

size_t size = entry->size + n * entry->var_el_size;
size_t total_size = CMSG_SPACE(size);

if (entry->var_el_size > 0
Copy link
Member

Choose a reason for hiding this comment

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

It would be better to make if (entry->var_el_size > 0) {} an outer if and move the code above inside it, to avoid the repeated and rather confusing check inside n_max.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, and forced push, this indeed makes the code less confusing.

This should also fix the null pointer arithmetic warning on MacOS as we don't depend on whack code written by Apple.
@Girgias Girgias force-pushed the csmg-sockets-refactor branch from d566c5a to 84d10d6 Compare April 14, 2020 14:35
@php-pulls php-pulls closed this in adea221 Apr 14, 2020
@Girgias Girgias deleted the csmg-sockets-refactor branch April 14, 2020 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants