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

[reSIProcate] NameAddr::parse() bug?


Hi all,

sish->peerAddr().displayName().c_str() returns a string with a leading
whitespace not present in sip msg (if display name is not doublequoted).
Do you confirm it?

e.g.:

From: 0015556678 <sip:foo@xxxxxxxxxxxxx>;tag=as548e6f07

NameAddr::parse(ParseBuffer& pb)
{
   [snip]
   if (!pb.eof() && *pb.position() == Symbols::STAR[0])
   {
        [snip]
   }
   else
   {
      if (!pb.eof() && *pb.position() == Symbols::DOUBLE_QUOTE[0])
      {
        [snip]
         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])
      {
        [snip]
      }
      else //<--------------------------------------------------------- not 
doublequoted display name case
      {
         start = pb.position();                 //start points at first '0' of 
0015556678 <sip:...
         pb.skipToChar(Symbols::LA_QUOTE[0]);   //now pb::mPosition points to 
'<'?
         if (pb.eof())
         {
            pb.reset(start);
         }
         else
         {
            laQuote = true;
            pb.data(mDisplayName, start);       //pb::data() makes a shared 
area starting from '0' ending at ' ' (mPosition - 1)
            pb.skipChar(Symbols::LA_QUOTE[0]);
         }
      }
      pb.skipWhitespace();
      mUri.parse(pb);
      [snip...]
-----------------------


Thank you very much
Regards
FF