Skip to content
Closed
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
2 changes: 1 addition & 1 deletion ext/sockets/conversions.c
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ static void from_zval_write_sin6_addr(const zval *zaddr_str, char *addr6, ser_co
} else {
/* error already emitted, but let's emit another more relevant */
do_from_zval_err(ctx, "could not resolve address '%s' to get an AF_INET6 "
"address", Z_STRVAL_P(zaddr_str));
"address", ZSTR_VAL(addr_str));
}

zend_tmp_string_release(tmp_addr_str);
Expand Down
19 changes: 19 additions & 0 deletions ext/sockets/tests/gh21161.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--TEST--
GH-21161 (IPV6_PKTINFO socket option crash with null addr array entry)
--EXTENSIONS--
sockets
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
die('skip.. Not valid for Windows');
}
?>
--FILE--
<?php
$sock = socket_create(AF_INET6, SOCK_DGRAM, 0);
socket_set_option($sock, IPPROTO_IPV6, IPV6_PKTINFO, ['addr' => null, 'ifindex' => 0]);
?>
--EXPECTF--
Warning: socket_set_option(): Host lookup failed [%i]: %s on line %d

Warning: socket_set_option(): error converting user data (path: in6_pktinfo > addr): could not resolve address '' to get an AF_INET6 address in %s on line %d
Loading