It seems this library uses the same underlying logic for parsing addresses in both inet_addr() and inet_pton(). However, because inet_addr() interprets numbers that start with 0 as octal, this creates an incompatibility with inet_pton() for any address where the last byte is zero. It causes outBase to be returned with the value of 8, and so inet_pton4() reports a failure.
It seems this library uses the same underlying logic for parsing addresses in both
inet_addr()
andinet_pton()
. However, becauseinet_addr()
interprets numbers that start with 0 as octal, this creates an incompatibility withinet_pton()
for any address where the last byte is zero. It causesoutBase
to be returned with the value of 8, and soinet_pton4()
reports a failure.Since this solution for
inet_addr()
is based on libctru, perhaps it would be good to reference their version ofinet_pton()
as well. https://github.com/devkitPro/libctru/blob/1f4669fa4c1517cc1018dc53c52662046296dff0/libctru/source/services/soc/soc_inet_pton.c#L7-L14