[reSIProcate] Parse bug in NameAddr
Byron Campen
bcampen at estacado.net
Wed Jun 7 09:32:24 CDT 2006
On closer inspection, it appears that the "/r/n" is not included in
the buffer by the MsgHeaderScanner. Also, whitespace at the end of a
name-addr or addr-spec is invalid, so this call is correct (although
the path to the parse error is a little odd).
Best regards,
Byron Campen
> Byron,
>
>
>
> Do you have a test case that will cause this bug to appear?
>
>
>
> Scott
>
>
>
> From: resiprocate-devel-bounces at list.sipfoundry.org
> [mailto:resiprocate-devel-bounces at list.sipfoundry.org] On Behalf Of
> Byron Campen
> Sent: Friday, June 02, 2006 12:56 PM
> To: resiprocate-devel
> Subject: [reSIProcate] Parse bug in NameAddr
>
>
>
> The code in question...
>
>
>
> *snip*
>
> if (!pb.eof() && *pb.position() == Symbols::DOUBLE_QUOTE[0])
>
> {
>
> start = pb.skipChar(Symbols::DOUBLE_QUOTE[0]);
>
> pb.skipToEndQuote();
>
> pb.data(mDisplayName, start);
>
> pb.skipChar(Symbols::DOUBLE_QUOTE[0]);
>
> laQuote = true;
>
> pb.skipToChar(Symbols::LA_QUOTE[0]);
>
> if (pb.eof())
>
> {
>
> throw ParseException("Expected '<'", __FILE__, __LINE__);
>
> }
>
> else
>
> {
>
> pb.skipChar(Symbols::LA_QUOTE[0]);
>
> }
>
> }
>
> else if (!pb.eof() && *pb.position() == Symbols::LA_QUOTE[0])
>
> {
>
> pb.skipChar(Symbols::LA_QUOTE[0]);
>
> laQuote = true;
>
> }
>
> else
>
> {
>
> start = pb.position();
>
> pb.skipToChar(Symbols::LA_QUOTE[0]);
>
> pb.skipBackWhitespace();
>
> if (pb.eof())
>
> {
>
> pb.reset(start);
>
> }
>
> else
>
> {
>
> laQuote = true;
>
> pb.data(mDisplayName, start);
>
> pb.skipToChar(Symbols::LA_QUOTE[0]);
>
> pb.skipChar(Symbols::LA_QUOTE[0]);
>
> }
>
> }
>
> pb.skipWhitespace();
>
> mUri.parse(pb);
>
>
>
> *snip*
>
>
>
> This code appears to be attempting to distinguish between
> a name-addr and an addr-spec as specified in 3261, by searching for
> a "<". Unfortunately, we never end up at eof in the addr-spec case
> because we skip back over the "\r\n". It looks like the
> skipBackWhitespace() call belongs inside the else clause
> immediately following the check for pb.eof(), right before we grab
> the display-name.
>
>
>
> Best regards,
>
> Byron Campen
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20060607/17900864/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2369 bytes
Desc: not available
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20060607/17900864/attachment.bin>
More information about the resiprocate-devel
mailing list