From: Khem Raj <raj.khem@gmail.com>
To: openembedded-devel@lists.openembedded.org
Subject: [meta-networking][PATCH 2/3] lowpan-tools: Fix build with gcc-8
Date: Thu, 31 May 2018 21:58:14 -0700 [thread overview]
Message-ID: <20180601045815.15819-2-raj.khem@gmail.com> (raw)
In-Reply-To: <20180601045815.15819-1-raj.khem@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
...tential-string-truncation-in-strncpy.patch | 139 ++++++++++++++++++
.../lowpan-tools/lowpan-tools_git.bb | 1 +
2 files changed, 140 insertions(+)
create mode 100644 meta-networking/recipes-support/lowpan-tools/lowpan-tools/0001-Fix-potential-string-truncation-in-strncpy.patch
diff --git a/meta-networking/recipes-support/lowpan-tools/lowpan-tools/0001-Fix-potential-string-truncation-in-strncpy.patch b/meta-networking/recipes-support/lowpan-tools/lowpan-tools/0001-Fix-potential-string-truncation-in-strncpy.patch
new file mode 100644
index 0000000000..e621d8f2a8
--- /dev/null
+++ b/meta-networking/recipes-support/lowpan-tools/lowpan-tools/0001-Fix-potential-string-truncation-in-strncpy.patch
@@ -0,0 +1,139 @@
+From 58b6d9a2efe101e5b80fd708e6f84c7ca779ce93 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 31 May 2018 20:27:43 -0700
+Subject: [PATCH] Fix potential string truncation in strncpy()
+
+GCC 8 complains about the string truncation during copy
+
+error: 'strncpy' specified bound 16 equals destination size
+
+Upstream-Status: Inappropriate [depricated component]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ tests/listen-packet.c | 3 ++-
+ tests/listen.c | 3 ++-
+ tests/test2.c | 4 ++--
+ tests/test3.c | 3 ++-
+ tests/test4.c | 3 ++-
+ tests/test5.c | 3 ++-
+ tests/test6.c | 3 ++-
+ tests/test7.c | 3 ++-
+ 8 files changed, 16 insertions(+), 9 deletions(-)
+
+diff --git a/tests/listen-packet.c b/tests/listen-packet.c
+index e40af81..eae0c71 100644
+--- a/tests/listen-packet.c
++++ b/tests/listen-packet.c
+@@ -50,7 +50,8 @@ int main(int argc, char **argv) {
+ return 1;
+ }
+
+- strncpy(req.ifr_name, iface, IF_NAMESIZE);
++ strncpy(req.ifr_name, iface, IF_NAMESIZE - 1);
++ req.ifr_name[IF_NAMESIZE - 1] = '\0';
+ ret = ioctl(sd, SIOCGIFINDEX, &req);
+ if (ret < 0)
+ perror("ioctl: SIOCGIFINDEX");
+diff --git a/tests/listen.c b/tests/listen.c
+index 75c320b..5ce1ed9 100644
+--- a/tests/listen.c
++++ b/tests/listen.c
+@@ -47,7 +47,8 @@ int main(int argc, char **argv) {
+ return 1;
+ }
+
+- strncpy(req.ifr_name, iface, IFNAMSIZ);
++ strncpy(req.ifr_name, iface, IFNAMSIZ - 1);
++ req.ifr_name[IF_NAMESIZE - 1] = '\0';
+ ret = ioctl(sd, SIOCGIFHWADDR, &req);
+ if (ret < 0)
+ perror("ioctl: SIOCGIFHWADDR");
+diff --git a/tests/test2.c b/tests/test2.c
+index 58eb74b..5d02838 100644
+--- a/tests/test2.c
++++ b/tests/test2.c
+@@ -45,8 +45,8 @@ int main(int argc, char **argv) {
+ perror("socket");
+ return 1;
+ }
+-
+- strncpy(req.ifr_name, argv[1] ?: "wpan0", IF_NAMESIZE);
++ strncpy(req.ifr_name, argv[1] ?: "wpan0", IF_NAMESIZE - 1);
++ req.ifr_name[IF_NAMESIZE - 1] = '\0';
+ ret = ioctl(sd, SIOCGIFHWADDR, &req);
+ if (ret < 0)
+ perror("ioctl: SIOCGIFHWADDR");
+diff --git a/tests/test3.c b/tests/test3.c
+index fb36627..2f50a5a 100644
+--- a/tests/test3.c
++++ b/tests/test3.c
+@@ -46,7 +46,8 @@ int main(int argc, char **argv) {
+ return 1;
+ }
+
+- strncpy(req.ifr_name, argv[1] ?: "wpan0", IF_NAMESIZE);
++ strncpy(req.ifr_name, argv[1] ?: "wpan0", IF_NAMESIZE - 1);
++ req.ifr_name[IF_NAMESIZE - 1] = '\0';
+ ret = ioctl(sd, SIOCGIFHWADDR, &req);
+ if (ret < 0)
+ perror("ioctl: SIOCGIFHWADDR");
+diff --git a/tests/test4.c b/tests/test4.c
+index 33c274c..8737149 100644
+--- a/tests/test4.c
++++ b/tests/test4.c
+@@ -46,7 +46,8 @@ int main(int argc, char **argv) {
+ return 1;
+ }
+
+- strncpy(req.ifr_name, argv[1] ?: "wpan0", IF_NAMESIZE);
++ strncpy(req.ifr_name, argv[1] ?: "wpan0", IF_NAMESIZE - 1);
++ req.ifr_name[IF_NAMESIZE - 1] = '\0';
+ ret = ioctl(sd, SIOCGIFHWADDR, &req);
+ if (ret < 0)
+ perror("ioctl: SIOCGIFHWADDR");
+diff --git a/tests/test5.c b/tests/test5.c
+index 4439dfa..28db562 100644
+--- a/tests/test5.c
++++ b/tests/test5.c
+@@ -45,7 +45,8 @@ int main(int argc, char **argv) {
+ return 1;
+ }
+
+- strncpy(req.ifr_name, argv[1] ?: "wpan0", IF_NAMESIZE);
++ strncpy(req.ifr_name, argv[1] ?: "wpan0", IF_NAMESIZE - 1);
++ req.ifr_name[IF_NAMESIZE - 1] = '\0';
+ ret = ioctl(sd, SIOCGIFADDR, &req);
+ if (ret < 0) {
+ perror("ioctl: SIOCGIFADDR");
+diff --git a/tests/test6.c b/tests/test6.c
+index e375bfb..ce7de59 100644
+--- a/tests/test6.c
++++ b/tests/test6.c
+@@ -45,7 +45,8 @@ int main(int argc, char **argv) {
+ return 1;
+ }
+
+- strncpy(req.ifr_name, argv[1] ?: "wpan0", IF_NAMESIZE);
++ strncpy(req.ifr_name, argv[1] ?: "wpan0", IF_NAMESIZE - 1);
++ req.ifr_name[IF_NAMESIZE - 1] = '\0';
+ ret = ioctl(sd, SIOCGIFADDR, &req);
+ if (ret < 0) {
+ perror("ioctl: SIOCGIFADDR");
+diff --git a/tests/test7.c b/tests/test7.c
+index e9a5a55..37da22d 100644
+--- a/tests/test7.c
++++ b/tests/test7.c
+@@ -58,7 +58,8 @@ int main(int argc, char **argv) {
+ if (ret)
+ perror("setsockopt");
+
+- strncpy(req.ifr_name, argv[1] ?: "wpan0", IF_NAMESIZE);
++ strncpy(req.ifr_name, argv[1] ?: "wpan0", IF_NAMESIZE - 1);
++ req.ifr_name[IF_NAMESIZE - 1] = '\0';
+ ret = ioctl(sd, SIOCGIFHWADDR, &req);
+ if (ret < 0)
+ perror("ioctl: SIOCGIFHWADDR");
+--
+2.17.1
+
diff --git a/meta-networking/recipes-support/lowpan-tools/lowpan-tools_git.bb b/meta-networking/recipes-support/lowpan-tools/lowpan-tools_git.bb
index d0fe59c983..b70c43f156 100644
--- a/meta-networking/recipes-support/lowpan-tools/lowpan-tools_git.bb
+++ b/meta-networking/recipes-support/lowpan-tools/lowpan-tools_git.bb
@@ -15,6 +15,7 @@ SRC_URI = "git://github.com/linux-wpan/lowpan-tools \
file://0001-src-iz.c-Undef-dprintf-before-redefining.patch \
file://0001-Remove-newline-from-format-line.patch \
file://0001-coordinator-Fix-strncpy-range-warning.patch \
+ file://0001-Fix-potential-string-truncation-in-strncpy.patch \
"
SRCREV = "1c2d8674cc6f4b1166a066e8822e295c105ae7a2"
--
2.17.1
next prev parent reply other threads:[~2018-06-01 4:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-01 4:58 [meta-oe][PATCH 1/3] fwts: Upgrade to V18.05.00 Khem Raj
2018-06-01 4:58 ` Khem Raj [this message]
2018-06-01 4:58 ` [meta-oe][PATCH 3/3] openocd: Upgrade to latest tip of master Khem Raj
2018-07-26 11:21 ` Martin Jansa
2018-07-26 14:20 ` Khem Raj
2018-07-26 14:23 ` Martin Jansa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180601045815.15819-2-raj.khem@gmail.com \
--to=raj.khem@gmail.com \
--cc=openembedded-devel@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox