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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
40 + 29 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 05:01:29 2024 UTC