[osmo-bts PATCH v4] src: Add OML support for sending failure message from manager

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 Apr 7 07:34:10 UTC 2014


Hi

On 05.04.2014 19:12, Pablo Neira Ayuso wrote:
> On Wed, Apr 02, 2014 at 01:36:57PM +0200, Alvaro Neira Ayuso wrote:
>> From: Álvaro Neira Ayuso <anayuso at sysmocom.de>
>>

>> diff --git a/src/osmo-bts-sysmo/misc/sysmobts_misc.c b/src/osmo-bts-sysmo/misc/sysmobts_misc.c
>> index 9ea26c2..0e89da6 100644
>> --- a/src/osmo-bts-sysmo/misc/sysmobts_misc.c
>> +++ b/src/osmo-bts-sysmo/misc/sysmobts_misc.
>> @@ -49,10 +53,144 @@
>>  #define SERIAL_ALLOC_SIZE	300
>>  #define SIZE_HEADER_RSP		5
>>  #define SIZE_HEADER_CMD		4
>> -
>> +#define OM_ALLOC_SIZE		1024
>> +#define OM_HEADROOM_SIZE	128
>> +#define IPA_OML_PROTO		0xFF
>>  
>>  #ifdef BUILD_SBTS2050
>>  /**********************************************************************
>> + *	Function send information to OsmoBts
>> + *********************************************************************/
>> +static void add_sw_descr(struct msgb *msg)
>> +{
>> +	char file_version[255];
>> +	char file_id[255];
>> +
>> +	strcpy(file_id, "sysmomgr");
> 
> Better use strncpy here.
> 
>> +	strncpy(file_version, PACKAGE_VERSION, strlen(PACKAGE_VERSION));
> 
> And make sure you nul-terminate these strings.
>
>         file_version[strlen(PACKAGE_VERSION)-1] = '\0';

This just the same like strcpy(file_version, PACKAGE_VERSION).

I'd rather expect

  strncpy(file_version, PACKAGE_VERSION, sizeof(file_version));
  file_version[sizeof(file_version)-1] = '\0';

> 
> As strncpy doesn't append the \0.

Jacob


-- 
- Jacob Erlbeck <jerlbeck at sysmocom.de>       http://www.sysmocom.de/
=======================================================================
* sysmocom - systems for mobile communications GmbH
* Schivelbeiner Str. 5
* 10439 Berlin, Germany
* Sitz / Registered office: Berlin, HRB 134158 B
* Geschaeftsfuehrer / Managing Directors: Holger Freyther, Harald Welte




More information about the OpenBSC mailing list