Skip to content

Commit d22454f

Browse files
committed
Fix GH-18617: socket_import_file_descriptor return check.
to_zval_read_fd_array() helper when retrieving the socket protocol did not check it.
1 parent 910aeaa commit d22454f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ext/sockets/conversions.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1457,7 +1457,10 @@ void to_zval_read_fd_array(const char *data, zval *zv, res_context *ctx)
14571457
object_init_ex(&elem, socket_ce);
14581458
php_socket *sock = Z_SOCKET_P(&elem);
14591459

1460-
socket_import_file_descriptor(fd, sock);
1460+
if (!socket_import_file_descriptor(fd, sock)) {
1461+
do_to_zval_err(ctx, "%s", sock->error);
1462+
return;
1463+
}
14611464
} else {
14621465
php_stream *stream = php_stream_fopen_from_fd(fd, "rw", NULL);
14631466
php_stream_to_zval(stream, &elem);

0 commit comments

Comments
 (0)