php.net |  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
Votes:1
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: amorum at brendata dot co dot uk
New email:
PHP Version: OS:

 

 [2016-10-07 16:21 UTC] amorum at brendata dot co dot uk
Description:
------------
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:

http://git.php.net/?p=pecl/networking/ssh2.git;a=commitdiff;h=2509998d3750cfaa026dfcf50cbbede24b796b6c




Patches

Pull Requests

History

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

Apparently, the problem must be somewhere else.

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

[1] <https://bugs.php.net/bugs-generating-backtrace.php>
 [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-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 21:01:27 2025 UTC