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

Re: [reSIProcate] String corruption?



mSize should never be greater than mCapacity.

As an aside, c_str() is overly agressive about taking ownership of the buffer. I
will probably fix that.

david

Quoting Christian_Gavin@xxxxxxxxxxxx:

In os\data.cxx

const char*
Data::c_str() const
{
  own();

  if (mSize >= mCapacity)      // !ah! we were overwritting the end
  {                            // !ah! when mSize == mCapacity !!
      const_cast<Data*>(this)->resize(mSize+1,true);
  }
  // mostly is zero terminated, but not by DataStream
  mBuf[mSize] = 0;
  return mBuf;
}

Does the comment imply that mSize should never be greater than mCapacity
and if it was it would mean memory corruption? Could that explain the crash
I am experiencing in the delete operator?

Thanks!
CG

_______________________________________________
resiprocate-devel mailing list
resiprocate-devel@xxxxxxxxxxxxxxxxxxx
https://list.sipfoundry.org/mailman/listinfo/resiprocate-devel