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

Re: [reSIProcate] race condition when Data::c_str


I'm not sure I follow what the problem is.  
Data d(msg.methodStr());
should use the const Data& constructor, which copies the string from methodStr()

However I could see how just calling msg.methodStr().c_str() could end up inserting the 0, however I'm not sure I see what problems a race condition here would cause, unless c_str needed to resize.  

Can you please explain this issue in more detail?

Thanks,
Scott




On Mon, Feb 3, 2014 at 10:24 AM, palladin <p-aladin@xxxxxxxxx> wrote:
Dear resip devels,
There is small issue with rutil::Data.
Please consider next scenario:
resip::MethodNames from MethodTypes.cxx
SipMessage msg
rutil::Data d( msg.methodStr() );

When you call d.c_str() - original MethodNames will be rewritten in Data::c_str() when assigning zero to mBuf[mSize].

Sincerely, tez.
_______________________________________________
resiprocate-devel mailing list
resiprocate-devel@resiprocate.org
https://list.resiprocate.org/mailman/listinfo/resiprocate-devel