summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/swig
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2018-05-09 13:24:22 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-05-15 10:56:49 +0100
commitd742dad9a0636446c050ad783e9450d22f4c21a2 (patch)
treec9029687e73615a96c14c18354785a98ee332b58 /meta/recipes-devtools/swig
parent6d8644569eba7ed309d62bea36ecb92be03a345e (diff)
downloadpoky-d742dad9a0636446c050ad783e9450d22f4c21a2.tar.gz
swig: Replace strncpy with memcpy
gcc8 is detecting string truncations when swig is used in other packages (From OE-Core rev: 828ae03da4468b4c672f71e1b4cac9b8fff73d2d) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/swig')
-rw-r--r--meta/recipes-devtools/swig/swig/swig-3.0.12-Coverity-fix-issue-reported-for-SWIG_Python_FixMetho.patch36
-rw-r--r--meta/recipes-devtools/swig/swig_3.0.12.bb1
2 files changed, 37 insertions, 0 deletions
diff --git a/meta/recipes-devtools/swig/swig/swig-3.0.12-Coverity-fix-issue-reported-for-SWIG_Python_FixMetho.patch b/meta/recipes-devtools/swig/swig/swig-3.0.12-Coverity-fix-issue-reported-for-SWIG_Python_FixMetho.patch
new file mode 100644
index 0000000000..eab50fc7ef
--- /dev/null
+++ b/meta/recipes-devtools/swig/swig/swig-3.0.12-Coverity-fix-issue-reported-for-SWIG_Python_FixMetho.patch
@@ -0,0 +1,36 @@
1From 9825fcbab5c4ddd867432f9922bebfbec7b78af0 Mon Sep 17 00:00:00 2001
2From: Mark Dufour <m.dufour@kopano.com>
3Date: Tue, 14 Feb 2017 10:34:37 +0100
4Subject: [PATCH] [Coverity] fix issue reported for SWIG_Python_FixMethods
5
6Fix Coverity issue reported for SWIG_Python_FixMethods:
7
8"buffer_size: Calling strncpy with a source string whose length
9(10 chars) is greater than or equal to the size argument (10)
10will fail to null-terminate buff."
11
12The issue is only reported for the "swig_ptr: " line, but for
13consistency we replace both occurrences of strncpy with memcpy.
14---
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16Status: Backport [https://github.com/swig/swig/pull/898]
17
18 Lib/python/pyinit.swg | 4 ++--
19 1 file changed, 2 insertions(+), 2 deletions(-)
20
21Index: swig-3.0.12/Lib/python/pyinit.swg
22===================================================================
23--- swig-3.0.12.orig/Lib/python/pyinit.swg
24+++ swig-3.0.12/Lib/python/pyinit.swg
25@@ -306,9 +306,9 @@ SWIG_Python_FixMethods(PyMethodDef *meth
26 char *ndoc = (char*)malloc(ldoc + lptr + 10);
27 if (ndoc) {
28 char *buff = ndoc;
29- strncpy(buff, methods[i].ml_doc, ldoc);
30+ memcpy(buff, methods[i].ml_doc, ldoc);
31 buff += ldoc;
32- strncpy(buff, "swig_ptr: ", 10);
33+ memcpy(buff, "swig_ptr: ", 10);
34 buff += 10;
35 SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
36 methods[i].ml_doc = ndoc;
diff --git a/meta/recipes-devtools/swig/swig_3.0.12.bb b/meta/recipes-devtools/swig/swig_3.0.12.bb
index 15f7348681..429840bde1 100644
--- a/meta/recipes-devtools/swig/swig_3.0.12.bb
+++ b/meta/recipes-devtools/swig/swig_3.0.12.bb
@@ -3,6 +3,7 @@ require ${BPN}.inc
3SRC_URI += "file://0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch \ 3SRC_URI += "file://0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch \
4 file://0001-configure-use-pkg-config-for-pcre-detection.patch \ 4 file://0001-configure-use-pkg-config-for-pcre-detection.patch \
5 file://0001-Add-Node-7.x-aka-V8-5.2-support.patch \ 5 file://0001-Add-Node-7.x-aka-V8-5.2-support.patch \
6 file://swig-3.0.12-Coverity-fix-issue-reported-for-SWIG_Python_FixMetho.patch \
6 " 7 "
7SRC_URI[md5sum] = "82133dfa7bba75ff9ad98a7046be687c" 8SRC_URI[md5sum] = "82133dfa7bba75ff9ad98a7046be687c"
8SRC_URI[sha256sum] = "7cf9f447ae7ed1c51722efc45e7f14418d15d7a1e143ac9f09a668999f4fc94d" 9SRC_URI[sha256sum] = "7cf9f447ae7ed1c51722efc45e7f14418d15d7a1e143ac9f09a668999f4fc94d"