Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ext/sockets/conversions.c
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,7 @@ static void to_zval_read_iov(const char *msghdr_c, zval *zv, res_context *ctx)
if (iovlen > UINT_MAX) {
do_to_zval_err(ctx, "unexpectedly large value for iov_len: %lu",
(unsigned long)iovlen);
return;
}
array_init_size(zv, (uint32_t)iovlen);

Expand Down
4 changes: 2 additions & 2 deletions ext/sockets/multicast.c
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ zend_result php_if_index_to_addr4(unsigned if_index, php_socket *php_sock, struc
retry:
retval = GetIpAddrTable(addr_table, &size, 0);
if (retval == ERROR_INSUFFICIENT_BUFFER) {
erealloc(addr_table, size);
addr_table = erealloc(addr_table, size);
goto retry;
}
if (retval != NO_ERROR) {
Expand Down Expand Up @@ -677,7 +677,7 @@ zend_result php_add4_to_if_index(struct in_addr *addr, php_socket *php_sock, uns
retry:
retval = GetIpAddrTable(addr_table, &size, 0);
if (retval == ERROR_INSUFFICIENT_BUFFER) {
erealloc(addr_table, size);
addr_table = erealloc(addr_table, size);
goto retry;
}
if (retval != NO_ERROR) {
Expand Down
8 changes: 6 additions & 2 deletions ext/sockets/sockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -1839,6 +1839,7 @@ PHP_FUNCTION(socket_get_option)
#endif

optlen = sizeof(other_val);
other_val = 0;

if (getsockopt(php_sock->bsd_socket, level, optname, (char*)&other_val, &optlen) != 0) {
PHP_SOCKET_ERROR(php_sock, "Unable to retrieve socket option", errno);
Expand All @@ -1864,6 +1865,10 @@ PHP_FUNCTION(socket_set_option)
int timeout;
#else
struct timeval tv;
#endif
#ifdef SO_ATTACH_REUSEPORT_CBPF
struct sock_filter cbpf[8] = {0};
struct sock_fprog bpfprog;
#endif
zend_long level, optname;
void *opt_ptr;
Expand Down Expand Up @@ -2074,8 +2079,6 @@ PHP_FUNCTION(socket_set_option)
optname = SO_DETACH_BPF;
} else {
uint32_t k = (uint32_t)cbpf_val;
static struct sock_filter cbpf[8] = {0};
static struct sock_fprog bpfprog;

switch (k) {
case SKF_AD_CPU:
Expand Down Expand Up @@ -2357,6 +2360,7 @@ PHP_FUNCTION(socket_import_stream)
retsock = Z_SOCKET_P(return_value);

if (!socket_import_file_descriptor(socket, retsock)) {
retsock->bsd_socket = -1;
zval_ptr_dtor(return_value);
RETURN_FALSE;
}
Expand Down
Loading