Skip to content

Fix error checking in mysqlnd#11925

Closed
kamil-tekiela wants to merge 1 commit into
php:PHP-8.1from
kamil-tekiela:Fix-wrong-error-checking-condition-in-mysqlnd
Closed

Fix error checking in mysqlnd#11925
kamil-tekiela wants to merge 1 commit into
php:PHP-8.1from
kamil-tekiela:Fix-wrong-error-checking-condition-in-mysqlnd

Conversation

@kamil-tekiela
Copy link
Copy Markdown
Member

The variable bytes_sent is ssize_t while the calling applications expect size_t. If the socket returns -1 then we overflow our unsigned return type and the calling code doesn't know the command failed.

I don't know how to write a test case for this. This was discovered thanks to this bug #11897. It definitely fixes a bug when a socket connection drops connection.

Copy link
Copy Markdown
Member

@devnexen devnexen left a comment

Choose a reason for hiding this comment

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

Makes sense to me.

jorgsowa pushed a commit to jorgsowa/php-src that referenced this pull request Aug 16, 2023
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.

2 participants