El 07/04/14 09:34, Jacob Erlbeck escribió:
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 <[email protected]>


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.

Sorry for don't answering the email before, but I have preferred answer you after send another version.

Thanks a lot Pablo and Jacob, I have applied yours corrections in my new patch.

Reply via email to