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

Fix infinite loop when enabling callback without handlers #7

Merged
merged 1 commit into from
Oct 4, 2024

Conversation

logmanoriginal
Copy link
Owner

When libssh2_session_callback_set() is used to activate a callback for which no handler was registered in libssh2_session_init_ex(), this can result in an infinite loop because the user event from lvssh2 is always registered automatically. When the callback is activated, it always returns default values because the VI refnum is undefined.

This changes the implementation so that the LabVIEW user event is only created when a valid VI refnum is provided. The extension library returns an error if the user event does not exist, which effectively breaks any infinite loops.

When libssh2_session_callback_set() is used to activate a callback
for which no handler was registered in libssh2_session_init_ex(),
this can result in an infinite loop because the user event from
lvssh2 is always registered automatically. When the callback is
activated, it always returns default values because the VI refnum
is undefined.

This changes the implementation so that the LabVIEW user event is
only created when a valid VI refnum is provided. The extension
library returns an error if the user event does not exist, which
effectively breaks any infinite loops.
@logmanoriginal logmanoriginal merged commit 898305a into main Oct 4, 2024
1 check passed
@logmanoriginal logmanoriginal deleted the session-cb-without-handler branch October 4, 2024 14:13
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.

1 participant