Skip to content

A little bug in example/ssh2_exec.c #1105

Closed

Description

@roy6307

Describe the bug
First of all, I'm so sorry for my poor english.
I found this bug when I running a example source.

https://github.com/libssh2/libssh2/blob/master/example/ssh2_exec.c#L263
At this line, the condition is rc == LIBSSH2_ERROR_EAGAIN.
And with this condition, the program can't read the responses properly.

So I suggest you to change the condition to "nread == LIBSSH2_ERROR_EAGAIN".

Version (please complete the following information):

  • OS and version: Linux version 5.15.0-1037-oracle (buildd@bos02-arm64-053) (gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #43-Ubuntu SMP Tue Jun 6 16:21:24 UTC 2023
  • libssh2 version: Master branch (commit 766bde9)
  • crypto backend and version:
    • OpenSSL 3.0.2 15 Mar 2022 (Library: OpenSSL 3.0.2 15 Mar 2022)
    • zlib1g-dev/jammy-updates,jammy-security,now 1:1.2.11.dfsg-2ubuntu9.2 arm64 (I'm not sure whether this is the ZLIB or not. sry)

Additional context
Would you check other examples?
The same bug may exist.
And always thank you for your porject.

Activity

  1. added a commit that references this issue on Jun 25, 2023
    ba487d7
  2. vszakats commented on Jun 25, 2023

    @vszakats
    Member

    Thanks for spotting this. The other two similar snippets got this update right. Opened #1106 for this one.

  3. roy6307 commented on Jun 25, 2023

    @roy6307
    Author

    Very fast fix. Thanks!

  4. added a commit that references this issue on Jun 25, 2023
    279a2e5
  5. added a commit that references this issue on Jul 16, 2023
    d598fd3
  6. added a commit that references this issue on Jul 14, 2024
    e67e229
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions