[PATCH] inet: make ether_aton() reject garbage after the address

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Tue Nov 12 11:24:21 GMT 2024



On 30/07/24 18:03, Miklós Máté wrote:
> On 29/07/2024 14:11, Andreas Schwab wrote:
>> On Jul 29 2024, Florian Weimer wrote:
>>
>>> However, inet_aton does not, where is is coming from.  See
>>> resolv/tst-inet_aton_exact.c.
>>>
>>> We should move off this behavior because it is really surprising.  I
>>> think for ether_aton, we can do it without introducing a compatibility
>>> symbol.
>>>
>>> Andreas, what do you think?
>> BSD does not reject trailing garbage.
>>
> I just checked the FreeBSD implementation [0], and it's even worse than the one in glibc (and BTW their struct ether_addr is incompatible). Their sscanf accepts "abcdef:fedcba:1234567890:0987654321:deadbeef:00000000000Mxyzptlk" as a valid MAC address.
> 
> [0] https://github.com/freebsd/freebsd-src/blob/6f25b46721a18cf4f036d041e7e5d275800a00b3/lib/libc/net/ether_addr.c#L86

Andrea, Florian, do we have a consensus about this change? I think Florian
is ok with this, but I am not sure about Andreas position.


More information about the Libc-alpha mailing list