php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23161 Net_Portscan::checkPort doesn't close socket
Submitted: 2003-04-11 03:56 UTC Modified: 2003-04-22 07:16 UTC
From: hasegawa at neo dot nectec dot or dot th Assigned:
Status: Closed Package: PEAR related
PHP Version: 4.3.0 OS: W2K
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: hasegawa at neo dot nectec dot or dot th
New email:
PHP Version: OS:

 

 [2003-04-11 03:56 UTC] hasegawa at neo dot nectec dot or dot th
Followings are the source code of Net_Portscan::checkPort.
[[Copy from http://cvs.php.net/co.php/pear/Net_Portscan/Portscan.php?login=2&r=1.3]]
------------------
function checkPort($host, $port, $timeout = 30)
    $socket = @fsockopen($host, $port, $errorNumber, $errorString, $timeout);

    if (!$socket) {
        return NET_PORTSCAN_NO_SERVICE;
    }

    return NET_PORTSCAN_SERVICE_FOUND;
}
------------------

When fsockopen successfuly connect the host/port, it returns resource for socket.  But above code doesn't close socket.
When fsockopen returns resource of socket, the socket should be closed with fclose function.

//Hasegawa

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-22 07:16 UTC] mj@php.net
This bug has been fixed. You can grab the latest version (1.0.2) at http://pear.php.net/Net_Portscan.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 00:01:30 2024 UTC