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
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: 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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 15:01:31 2024 UTC