php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74400 Suspicious function adress usage
Submitted: 2017-04-10 07:01 UTC Modified: -
From: appchecker at cnpo dot ru Assigned:
Status: Closed Package: *General Issues
PHP Version: 7.1.4RC1 OS:
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: appchecker at cnpo dot ru
New email:
PHP Version: OS:

 

 [2017-04-10 07:01 UTC] appchecker at cnpo dot ru
Description:
------------
Hello!

We've checked your code with AppChecker static analyzer and found possible bug:

https://github.com/php/php-src/blob/e0f68ae1441bac063e2a72b980f1ddfee596ea25/sapi/phpdbg/phpdbg_io.c#L352

PHPDBG_API void phpdbg_close_socket(int sock) {
    if (socket >= 0) {
#ifdef _WIN32
        closesocket(sock);
#else
        shutdown(sock, SHUT_RDWR);
        close(sock);
#endif
    }
}

socket is a function. It seems suspicious to compare pointer with '0'. Maybe variable sock must be used instead?

Possible defect was found by Echelon Team with [AppChecker static analyzer](https://cnpo.ru/en/solutions/appchecker.php)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-04-10 07:07 UTC] krakjoe@php.net
Automatic comment on behalf of krakjoe
Revision: http://git.php.net/?p=php-src.git;a=commit;h=60b68f19f0618c884b9d97da79bd0b5c06c35072
Log: Fixed bug #74400 (phpdbg comparing socket function to int)
 [2017-04-10 07:07 UTC] krakjoe@php.net
-Status: Open +Status: Closed
 [2017-04-10 07:07 UTC] krakjoe@php.net
Automatic comment on behalf of krakjoe
Revision: http://git.php.net/?p=php-src.git;a=commit;h=60b68f19f0618c884b9d97da79bd0b5c06c35072
Log: Fixed bug #74400 (phpdbg comparing socket function to int)
 [2017-04-10 07:08 UTC] krakjoe@php.net
Automatic comment on behalf of krakjoe
Revision: http://git.php.net/?p=php-src.git;a=commit;h=60b68f19f0618c884b9d97da79bd0b5c06c35072
Log: Fixed bug #74400 (phpdbg comparing socket function to int)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jun 03 04:01:26 2025 UTC