php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73854 Always true condition in php_openssl_sockop_io
Submitted: 2017-01-03 04:23 UTC Modified: -
From: dereckson at espace-win dot org Assigned:
Status: Closed Package: OpenSSL related
PHP Version: 7.1Git-2017-01-03 (Git) OS: FreeBSD
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: dereckson at espace-win dot org
New email:
PHP Version: OS:

 

 [2017-01-03 04:23 UTC] dereckson at espace-win dot org
Description:
------------
Commit bbfd4a5e62c offers to "fix crypto stream timeout regressions".


It introduces the following  code snippet in php_openssl_sockop_io function:

               /* never use a timeout with non-blocking sockets */
               if (began_blocked && &sslsock->s.timeout) {
                       timeout = &sslsock->s.timeout;
               }

(currently in ext/openssl/xp_ssl.c around line 1910)

This condition will be always true, as this syntax means "take the address of sslsock->s.timeout".

This is caught by clang/llvm compiler:

/home/dereckson/dev/php/php-src/ext/openssl/xp_ssl.c:1908:36: warning: address of 'sslsock->s.timeout' will always evaluate to 'true' [-Wpointer-bool-conversion]
                if (began_blocked && &sslsock->s.timeout) {
                                  ~~  ~~~~~~~~~~~^~~~~~~
1 warning generated.


Expected result:
----------------
To get the timeout value

Actual result:
--------------
Always true, as it gets the address

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-09 08:31 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=f7cb79431f621381722f504e75d1e71e72df6de9
Log: Fixed bug #73854 (Always true condition in php_openssl_sockop_io)
 [2017-01-09 08:31 UTC] laruence@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 17:01:34 2025 UTC