Skip to content

Commit 476d01e

Browse files
committed
fixes and comment
1 parent 7a904bb commit 476d01e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ext/sockets/sockets.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1946,6 +1946,9 @@ PHP_FUNCTION(socket_set_option)
19461946
zend_argument_value_error(4, "must not contain null bytes when argument #3 ($option) is TCP_FUNCTION_BLK");
19471947
RETURN_THROWS();
19481948
}
1949+
/* [...] the unique name of the TCP stack, and should be no longer than
1950+
* TCP_FUNCTION_NAME_LEN_MAX-1 characters in length.
1951+
* https://github.com/freebsd/freebsd-src/blob/da2c88dfcf4f425e6e0a58d6df3a7c8e88d8df92/share/man/man9/tcp_functions.9#L193C1-L194C50 */
19491952
if (Z_STRLEN_P(arg4) > TCP_FUNCTION_NAME_LEN_MAX) {
19501953
zend_argument_value_error(4, "must be less than %zu bytes when argument #3 ($option) is TCP_FUNCTION_BLK", TCP_FUNCTION_NAME_LEN_MAX);
19511954
RETURN_THROWS();
@@ -2082,11 +2085,11 @@ PHP_FUNCTION(socket_set_option)
20822085
zend_argument_value_error(4, "must not contain null bytes when argument #3 ($option) is SO_ACCEPTFILTER");
20832086
RETURN_THROWS();
20842087
}
2088+
struct accept_filter_arg af = {0};
20852089
if (Z_STRLEN_P(arg4) > sizeof(af.af_name)) {
20862090
zend_argument_value_error(4, "must be less than %zu bytes when argument #3 ($option) is SO_ACCEPTFILTER", sizeof(af.af_name));
20872091
RETURN_THROWS();
20882092
}
2089-
struct accept_filter_arg af = {0};
20902093
/* Copy the trailing nul byte */
20912094
memcpy(af.af_name, Z_STRVAL_P(arg4), Z_STRLEN_P(arg4)+1);
20922095
opt_ptr = ⁡

0 commit comments

Comments
 (0)