Skip to content

Commit fa73e3b

Browse files
committed
php#53: * Fix Windows socket validation in network streams
Replace `clisock >= 0` comparisons with `ZEND_VALID_SOCKET(clisock)` to properly handle Windows SOCKET type (unsigned int) where INVALID_SOCKET = ~0. Files modified: - main/streams/xp_socket.c:973 - ext/openssl/xp_ssl.c:2266
1 parent 8d195b6 commit fa73e3b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

ext/openssl/xp_ssl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2263,7 +2263,7 @@ static inline int php_openssl_tcp_sockop_accept(php_stream *stream, php_openssl_
22632263
nodelay);
22642264
}
22652265

2266-
if (clisock >= 0) {
2266+
if (ZEND_VALID_SOCKET(clisock)) {
22672267
php_openssl_netstream_data_t *clisockdata = (php_openssl_netstream_data_t*) emalloc(sizeof(*clisockdata));
22682268

22692269
/* copy underlying tcp fields */

main/streams/xp_socket.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ static inline int php_tcp_sockop_accept(php_stream *stream, php_netstream_data_t
970970
nodelay);
971971
}
972972

973-
if (clisock >= 0) {
973+
if (ZEND_VALID_SOCKET(clisock)) {
974974
php_netstream_data_t *clisockdata = (php_netstream_data_t*) emalloc(sizeof(*clisockdata));
975975

976976
memcpy(clisockdata, sock, sizeof(*clisockdata));

0 commit comments

Comments
 (0)