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: 2016-10-08 09:25 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:
Status: Open 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
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>
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Aug 22 07:01:26 2019 UTC