Skip to content

A little bug in example/ssh2_exec.c #1105

@roy6307

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.

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