On 27/03/2024 01:51, Sergey Chernyshev wrote:

Hello Core Libs Dev team,

I would like to propose a PR to extend the InetAddress API in JDK 23, namely to provide interface to constructing InetAddress objects from literal addresses in POSIX/BSD form (please see the discussion [1]), to the Apps that need to mimic the behavior of POSIX network APIs (|inet_addr|) used by standard network utilities such as netcat/curl/wget and the majority of web browsers. At present time, there's no way to construct |InetAddress| object from such literal addresses because the new API |InetAddress.ofLiteral()| and |Inet4Address.ofLiteral()| will consume an address and successfully parse it as decimal, ignoring the octal prefix. Hence, the resulting object will point to a different IP address than it is expected to point to.

Better to start the discussion on net-dev as that is where the InetAddress API is maintained. Make sure to go through the recent discussions there on ofLiteral(String), particularly security concerns which is partly why the method is not specified to allow octal values.

-Alan

Reply via email to