[asterisk-dev] [Code Review] SIP URI comparison test (plus some bug fixes)

Kevin P. Fleming kpfleming at digium.com
Wed Jul 21 07:10:45 CDT 2010


On 07/21/2010 11:50 AM, Olle E. Johansson wrote:
> 
> 21 jul 2010 kl. 10.52 skrev Kaloyan Kovachev:
> 
>> On Wed, 21 Jul 2010 10:18:43 +0200, "Kevin P. Fleming"
>> <kpfleming at digium.com> wrote:
>>> On 07/21/2010 10:00 AM, Olle E. Johansson wrote:
>>>>
>>>>
>>>>
>>>> While writing the bug report I forgot to mention that the string
>>>> comparision of IP also affects IPv4.
>>>>
>>>> 192.02.68.01 == 192.02.68.1
>>>> 192.2.068.1 != 192.2.68.1
>>>>
>>>> The zero prefix indicates that the group is written in octal
>> notation...
>>>
>>> Are you sure about that? The ABNF that Mark already posted shows that
>>> each group is limited to three digits, and three digits is not adequate
>>> to allow for the range 0-255 to be expressed on octal, only in decimal.
>>>
>>
>> Hmmm 255 in octal is 377, so three digits should be enough
> 
> But you have to prefix it with a zero to make it octal in the notation, which ends up being four digits.
> 
> Kevin - I have no good answer for you. I know this has come up from time to time at SIPits, since the normal libraries used parse this as octal. That's propably one reason that the comparision has to be binary, but I see what you mean.
> 
> I'll try to check.

Yeah, we've gone through explicit steps in Asterisk to ensure that
zero-prefixed strings are *not* interpreted as octal, since that's
rarely what the user intended. I wonder if the example you posted from
the ipv6-abnf-fix draft was just demonstrating the difference between a
textual comparison and a binary comparison, even if both versions were
expected to be parsed as decimal values (since 192.168.00.02 and
192.168.0.2 don't match as text whether they are decimal or octal).

-- 
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
skype: kpfleming | jabber: kfleming at digium.com
Check us out at www.digium.com & www.asterisk.org



More information about the asterisk-dev mailing list