[asterisk-dev] [Code Review] SIP URI comparison test (plus some bug fixes)
Kaloyan Kovachev
kkovachev at varna.net
Wed Jul 21 04:15:46 CDT 2010
On Wed, 21 Jul 2010 11:09:54 +0200, Kevin P. Fleming wrote
> On 07/21/2010 10:52 AM, Kaloyan Kovachev wrote:
> > 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:
> >>>
> >>> 20 jul 2010 kl. 15.15 skrev Simon Perreault:
> >>>
> >>>> /trunk/channels/sip/reqresp_parser.c
> >>>> <https://reviewboard.asterisk.org/r/792/#comment5354>
> >>>>
> >>>> There's a subtle but important bug here: glibc's strcasecmp() is
> >>>> locale-dependent. SIP URI domains are limited to the ASCII
> > character
> >>>> set. So we want ASCII-based case-insensitive comparison, not
> >>>> something that depends on the current locale.
> >>>>
> >>>> This could be solved by using strcasecmp_l() and passing the "C"
> >>>> locale (I think). Or just roll your own ASCII-based strcasecmp().
> >>>
> >>> That is a huge issue and possibly affects many different parts of
> >>> asterisk.
> >>>
> >>> 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
>
> No, it would have to be written 0377, which is four digits (the '0'
> prefix indicates that it is octal).
>
oops forgot the '0'. Sorry for the noise.
> --
> 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
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-dev
More information about the asterisk-dev
mailing list