|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73266 crash due to incorrect definition of variable storing return of libssh2_sftp_re
Submitted: 2016-10-07 16:21 UTC Modified: 2021-02-21 04:22 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: amorum at brendata dot co dot uk Assigned: cmb (profile)
Status: No Feedback Package: ssh2 (PECL)
PHP Version: 7.0.11 OS: any
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2016-10-07 16:21 UTC] amorum at brendata dot co dot uk
Attempting to ls from some servers results in a crash.

This is because the line

int bytesread = libssh2_sftp_readdir(data->handle, ent->d_name, sizeof(ent->d_name) - 1, NULL);

should really be
ssize_t bytesread = libssh2_sftp_readdir(data->handle, ent->d_name, sizeof(ent->d_name) - 1, NULL);

This was already fixed once, but it seems to have been reverted, see:;a=commitdiff;h=2509998d3750cfaa026dfcf50cbbede24b796b6c


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-10-08 09:25 UTC]
Actually, libssh2_sftp_readdir() is supposed to return an int[1].

Apparently, the problem must be somewhere else.

[1] <>
 [2021-02-09 17:07 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-02-09 17:07 UTC]
That fix still looks good to me, so if you still experience the
reported segfaults, please provide a stack backtrace[1].

[1] <>
 [2021-02-21 04:22 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Jul 06 09:03:38 2022 UTC