[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/.

Pablo Neira Ayuso pablo at gnumonks.org
Mon Apr 7 09:31:51 UTC 2014


On Mon, Apr 07, 2014 at 09:34:10AM +0200, Jacob Erlbeck wrote:
> 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));

Ah I see, you mean the sizeof(...) instead strlen(...). I didn't
notice.  Indeed, that needs to be fixed Alvaro, thanks for spotting
it :).

>   file_version[sizeof(file_version)-1] = '\0';
> 
> > 
> > As strncpy doesn't append the \0.




More information about the OpenBSC mailing list