[PATCH] resolv: add IPv6 support to inet_net_pton()

Andreas Schwab schwab@suse.de
Mon Mar 25 08:45:03 GMT 2024


On Mär 22 2024, Job Snijders wrote:

> The above to me means that it is not enough to just check whether errno
> is set to ERANGE, but one also has to check whether LONG_MAX or LONG_MIN
> were returned. It's an 'AND' operation.

That is irrelevant.

> Then, if errno is NOT set to ERANGE, then we have to additionally check
> whether the value is within contextual bounds.

By checking the range you already know that the value is neither
LONG_MAX nor LONG_MIN, thus the errno value does not matter.  This is
simple logic.

> So I don't think it is correct to skimp on checks here, to me idiomatic
> checks do not equate 'bad'.

A source analyzer will likely flag it, which makes it even worse.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


More information about the Libc-alpha mailing list