[PATCH 5/8] mgcp: NUL-terminate MGCP message

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Jacob Erlbeck jerlbeck at sysmocom.de
Mon Dec 2 10:47:38 UTC 2013


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




More information about the OpenBSC mailing list