Skip to content
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

Throw an error when a packet can not be read to prevent infinite loop #1678

Closed
wants to merge 1 commit into from

Conversation

ashokadewit
Copy link

The method SSH2::_get_channel_packet() returns false when
the connection has been closed. This would cause an infinite loop
in SFTP::_get_sftp_packet because it keeps reading until the packet
buffer length is 4. To solve this a runtime exception is thrown when the
return value is false.

The method SSH2::_get_channel_packet() returns false when
the connection has been closed. This would cause an infinite loop
in SFTP::_get_sftp_packet because it keeps reading until the packet
buffer length is 4. To solve this a runtime exception is thrown when the
return value is false.
@ashokadewit
Copy link
Author

This change is not needed in ^3.0 because there the method never returns false but throws an exception instead.

@terrafrost
Copy link
Member

The 2.0 branch doesn't throw exceptions - it does user_error(). Exceptions are better, which is why 3.0 adopted them, but, in-so-far as 2.0 is concerned, they'd be a BC break, in-so-far a I'm concerned.

Here's what I did instead:

a02526e

Thanks!

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