On 12/02/2013 11:14 AM, Holger Hans Peter Freyther wrote:
On Mon, Dec 02, 2013 at 10:21:58AM +0100, Jacob
Erlbeck wrote:
What's about changing msgb to always write a
\0 after the data area
every time tail gets modified? Like with QByteArray you could always
safely use string functions without handling this explicitely. But I'm
afraid there is some code already that relies of changing tail freely
without expecting this to cause this kind of side effect even when used
with put. Perhaps one can make this optional?
In theory we always over allocate the msgb and due the usage of
talloc_zero should make sure that we have many NULLs at the end.
The other problem here is, that the buffer gets reused for each MGCP
message, so we always have NUL-terminated strings (which made valgrind
at al happy all the time) but occasionally with garbage at the end.
Jacob