< Previous by Date Date Index Next by Date >
< Previous in Thread Thread Index  

Re: [reSIProcate] Parse bug in NameAddr


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@xxxxxxxxxxxxxxxxxxx [mailto:resiprocate-devel-bounces@xxxxxxxxxxxxxxxxxxx] 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



Attachment: smime.p7s
Description: S/MIME cryptographic signature