mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Fix GH-18617: socket_import_file_descriptor return check.
to_zval_read_fd_array() helper when retrieving the socket protocol did not check it. close GH-18617
This commit is contained in:
4
NEWS
4
NEWS
@@ -47,6 +47,10 @@ PHP NEWS
|
||||
- PDO_OCI:
|
||||
. Fixed bug GH-18494 (PDO OCI segfault in statement GC). (nielsdos)
|
||||
|
||||
- Sockets:
|
||||
- Fixed bug GH-18617 (socket_import_file_descriptor return value
|
||||
unchecked). (David Carlier)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug GH-18421 (Integer overflow with large numbers in LimitIterator).
|
||||
(nielsdos)
|
||||
|
||||
@@ -1457,7 +1457,11 @@ void to_zval_read_fd_array(const char *data, zval *zv, res_context *ctx)
|
||||
object_init_ex(&elem, socket_ce);
|
||||
php_socket *sock = Z_SOCKET_P(&elem);
|
||||
|
||||
socket_import_file_descriptor(fd, sock);
|
||||
if (!socket_import_file_descriptor(fd, sock)) {
|
||||
do_to_zval_err(ctx, "error getting protocol descriptor %d: getsockopt() call failed with errno %d", fd, errno);
|
||||
zval_ptr_dtor(&elem);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
php_stream *stream = php_stream_fopen_from_fd(fd, "rw", NULL);
|
||||
php_stream_to_zval(stream, &elem);
|
||||
|
||||
Reference in New Issue
Block a user