[fpc-pascal] Bug 37080 -- StrToHostAddr accepts all Pascal number notations
Noel Duffy
noelduffy at xtra.co.nz
Fri May 15 14:48:52 CEST 2020
On 15/05/20 11:25 pm, Michael Van Canneyt wrote:
>
>
> On Fri, 15 May 2020, Noel Duffy via fpc-pascal wrote:
>
>> That must be a new record in bug fix speed. You fixed that within ten
>> minutes of my message to the list!
>>
>> I forgot to mention in my message, but did mention in the bug report,
>> that leading zeroes are also allowed, so you can parse:
>>
>> 0000000001.1.1.1
>
> Personally I don't think this is a problem (mathematically, you can add as
> many zeroes as you like), but I can imagine some do, so I fixed it.
Well, the same argument could be made for allowing hexadecimal or other
notations. But ip address representation formats aren't just numbers,
they're textual representations meant for easy transmission between
programs and across networks, and the standards documents are quite
clear about what's allowed in them and what's not. If StrToHostAddr
breaks with those standards and accepts addresses that other
implementations won't, or rejects addresses others accept, that makes it
unusable for programs that must operate in mixed language environments.
In my own case, I'm writing a program to parse and validate SPF records,
as defined in RFC7208. SPF records are read and processed by SMTP
servers as they receive mail, so any tools that attempt to validate SPF
records must not accept as valid any ipv4 or ipv6 address that the SMTP
server won't also accept.
More information about the fpc-pascal
mailing list