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
 [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: Thu Apr 18 02:02:52 2024 UTC