mirror of
https://github.com/php/php-src.git
synced 2024-11-24 02:15:04 +08:00
Fixed bug #60106 (stream_socket_server silently truncates long unix socket paths)
This commit is contained in:
parent
5b4adeae9b
commit
67db5de6b2
14
ext/standard/tests/streams/bug60106.phpt
Normal file
14
ext/standard/tests/streams/bug60106.phpt
Normal file
@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Bug#60106 (stream_socket_server silently truncates long unix socket paths)
|
||||
--FILE--
|
||||
<?php
|
||||
error_reporting(E_ALL | E_NOTICE);
|
||||
stream_socket_server("unix:///tmp/" . str_repeat("a", 4096));
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Notice: stream_socket_server(): socket path exceeded the maximum allowed length of %d bytes and was truncated in %s on line %d
|
||||
|
||||
Warning: stream_socket_server(): unable to connect to unix:///tmp/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa in %s on line %d
|
||||
===DONE===
|
||||
|
@ -510,6 +510,7 @@ static inline int parse_unix_address(php_stream_xport_param *xparam, struct sock
|
||||
* BUT, to get into this branch of code, the name is too long,
|
||||
* so we don't care. */
|
||||
xparam->inputs.namelen = sizeof(unix_addr->sun_path) - 1;
|
||||
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "socket path exceeded the maximum allowed length of %ld bytes and was truncated", sizeof(unix_addr->sun_path));
|
||||
}
|
||||
|
||||
memcpy(unix_addr->sun_path, xparam->inputs.name, xparam->inputs.namelen);
|
||||
|
Loading…
Reference in New Issue
Block a user