[oe-commits] [meta-openembedded] 26/60: upm: Fix build with gcc8

git at git.openembedded.org git at git.openembedded.org
Fri May 18 14:43:46 UTC 2018


This is an automated email from the git hooks/post-receive script.

armin_kuster pushed a commit to branch master
in repository meta-openembedded.

commit a2b026529c6443056acf3cbf6231c202b349603f
Author: Khem Raj <raj.khem at gmail.com>
AuthorDate: Wed May 9 12:00:11 2018 -0700

    upm: Fix build with gcc8
    
    Signed-off-by: Khem Raj <raj.khem at gmail.com>
    Signed-off-by: Armin Kuster <akuster808 at gmail.com>
---
 .../upm/upm/0001-Replace-strncpy-with-memcpy.patch | 49 ++++++++++++++++++++++
 meta-oe/recipes-extended/upm/upm_git.bb            |  3 +-
 2 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/meta-oe/recipes-extended/upm/upm/0001-Replace-strncpy-with-memcpy.patch b/meta-oe/recipes-extended/upm/upm/0001-Replace-strncpy-with-memcpy.patch
new file mode 100644
index 0000000..4b17087
--- /dev/null
+++ b/meta-oe/recipes-extended/upm/upm/0001-Replace-strncpy-with-memcpy.patch
@@ -0,0 +1,49 @@
+From d314f26e024aaf15bf4ab22ceb98501148d0eac8 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Mon, 7 May 2018 19:53:33 -0700
+Subject: [PATCH] Replace strncpy with memcpy
+
+gcc8 detects that strncpy is overwiritng the null terminating character
+the source strings are already initialized to 0 so memcpy would do the same
+job
+
+Fixes
+rn2903.c:153:5: error: 'strncpy' output may be truncated copying 16 bytes from a string of length 511 [-Werror=stringop-truncation]
+     strncpy(dev->hardware_eui, dev->resp_data, RN2903_MAX_HEX_EUI64);
+     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+---
+ src/ecezo/ecezo.c   | 2 +-
+ src/rn2903/rn2903.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/ecezo/ecezo.c b/src/ecezo/ecezo.c
+index 6a195fc1..56c6dab3 100644
+--- a/src/ecezo/ecezo.c
++++ b/src/ecezo/ecezo.c
+@@ -488,7 +488,7 @@ int ecezo_send_command(const ecezo_context dev, char *cmd, char *buffer,
+     // our write buffer
+     char writeBuffer[ECEZO_MAX_BUFFER_LEN];
+ 
+-    strncpy(writeBuffer, cmd, ECEZO_MAX_BUFFER_LEN);
++    memcpy(writeBuffer, cmd, ECEZO_MAX_BUFFER_LEN-1);
+     writeBuffer[ECEZO_MAX_BUFFER_LEN - 1] = 0;
+ 
+     int writelen = strlen(writeBuffer);
+diff --git a/src/rn2903/rn2903.c b/src/rn2903/rn2903.c
+index f30a33ae..01a011da 100644
+--- a/src/rn2903/rn2903.c
++++ b/src/rn2903/rn2903.c
+@@ -150,7 +150,7 @@ static rn2903_context _rn2903_postinit(rn2903_context dev,
+         rn2903_close(dev);
+         return NULL;
+     }
+-    strncpy(dev->hardware_eui, dev->resp_data, RN2903_MAX_HEX_EUI64);
++    memcpy(dev->hardware_eui, dev->resp_data, RN2903_MAX_HEX_EUI64);
+ 
+     return dev;
+ }
+-- 
+2.17.0
+
diff --git a/meta-oe/recipes-extended/upm/upm_git.bb b/meta-oe/recipes-extended/upm/upm_git.bb
index d742a5e..478aa0d 100644
--- a/meta-oe/recipes-extended/upm/upm_git.bb
+++ b/meta-oe/recipes-extended/upm/upm_git.bb
@@ -7,11 +7,12 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=66493d54e65bfc12c7983ff2e884f37f"
 
 DEPENDS = "libjpeg-turbo mraa"
 
-SRCREV = "cc7fec9ae0228add9011bf1c2cd5e0ca2ba0d4f0"
+SRCREV = "37642f3b0194f6ddd63f1e6b5d49b8cb689d5c81"
 PV = "1.6.0-git${SRCPV}"
 
 SRC_URI = " \
     git://github.com/intel-iot-devkit/${BPN}.git;protocol=http \
+    file://0001-Replace-strncpy-with-memcpy.patch \
 "
 
 S = "${WORKDIR}/git"

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list