summaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-daemons
diff options
context:
space:
mode:
Diffstat (limited to 'meta-networking/recipes-daemons')
-rw-r--r--meta-networking/recipes-daemons/iscsi-initiator-utils/files/0001-Fix-i586-build-issues-with-string-length-overflow.patch115
-rw-r--r--meta-networking/recipes-daemons/iscsi-initiator-utils/iscsi-initiator-utils_2.0.876.bb1
2 files changed, 116 insertions, 0 deletions
diff --git a/meta-networking/recipes-daemons/iscsi-initiator-utils/files/0001-Fix-i586-build-issues-with-string-length-overflow.patch b/meta-networking/recipes-daemons/iscsi-initiator-utils/files/0001-Fix-i586-build-issues-with-string-length-overflow.patch
new file mode 100644
index 000000000..f945c636f
--- /dev/null
+++ b/meta-networking/recipes-daemons/iscsi-initiator-utils/files/0001-Fix-i586-build-issues-with-string-length-overflow.patch
@@ -0,0 +1,115 @@
1From 24ce8f62e042e69497e1299212504c356179e15b Mon Sep 17 00:00:00 2001
2From: Lee Duncan <lduncan@suse.com>
3Date: Tue, 6 Nov 2018 11:16:06 -0800
4Subject: [PATCH] Fix i586 build issues with string length overflow.
5
6Gcc7 warns of possible string print overflow, on i586,
7when printing password length (via a macro), generating
8errors like:
9
10[ 59s] ^~~~~~~~~~~~~~~~~~~~
11[ 59s] In file included from /usr/include/stdio.h:862:0,
12[ 59s] from idbm.h:27,
13[ 59s] from context.h:22,
14[ 59s] from idbm.c:59:
15[ 59s] /usr/include/bits/stdio2.h:64:10: note:
16'__builtin___snprintf_chk' output between 2 and 11 bytes into a
17destination of size 8
18[ 59s] return __builtin___snprintf_chk (__s, __n,
19__USE_FORTIFY_LEVEL - 1,
20[ 59s] ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21~~~~~~~~~~
22[ 59s] __bos (__s), __fmt, __va_arg_pack ());
23[ 59s] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24[ 59s] cc1: all warnings being treated as errors
25[ 59s] make[1]: *** [<builtin>: idbm.o] Error 1
26[ 59s] make[1]: Leaving directory
27
28The fix is to limit the size of the string printed, so that no
29overflow is possible.
30
31The print macros in usr/idbm.c were updated, as well, to match
32the newer version in libopeniscsiusr/idbm.c, also to help the
33i586 build.
34
35Upstream-Status: Backport[https://github.com/open-iscsi/open-iscsi/commit/24ce8f62e042e69497e1299212504c356179e15b]
36
37Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
38---
39 libopeniscsiusr/idbm.c | 2 +-
40 usr/idbm.c | 11 ++++++-----
41 2 files changed, 7 insertions(+), 6 deletions(-)
42
43diff --git a/libopeniscsiusr/idbm.c b/libopeniscsiusr/idbm.c
44index 7724de2..055dd9a 100644
45--- a/libopeniscsiusr/idbm.c
46+++ b/libopeniscsiusr/idbm.c
47@@ -676,7 +676,7 @@ updated:
48 if (!passwd_done && !strcmp(#_param, name)) { \
49 passwd_done = 1; \
50 name = #_param "_length"; \
51- snprintf(passwd_len, 8, "%d", (int)strlen(value)); \
52+ snprintf(passwd_len, 8, "%.7d", (int)strlen(value) & 0xffff); \
53 value = passwd_len; \
54 goto setup_passwd_len; \
55 }
56diff --git a/usr/idbm.c b/usr/idbm.c
57index a0207e2..89a6c27 100644
58--- a/usr/idbm.c
59+++ b/usr/idbm.c
60@@ -30,6 +30,7 @@
61 #include <fcntl.h>
62 #include <sys/stat.h>
63 #include <sys/file.h>
64+#include <inttypes.h>
65
66 #include "idbm.h"
67 #include "idbm_fields.h"
68@@ -65,7 +66,7 @@ static struct idbm *db;
69 #define __recinfo_int(_key, _info, _rec, _name, _show, _n, _mod) do { \
70 _info[_n].type = TYPE_INT; \
71 strlcpy(_info[_n].name, _key, NAME_MAXVAL); \
72- snprintf(_info[_n].value, VALUE_MAXVAL, "%d", _rec->_name); \
73+ snprintf(_info[_n].value, VALUE_MAXVAL, "%" PRIi32, _rec->_name); \
74 _info[_n].data = &_rec->_name; \
75 _info[_n].data_len = sizeof(_rec->_name); \
76 _info[_n].visible = _show; \
77@@ -76,7 +77,7 @@ static struct idbm *db;
78 #define __recinfo_uint8(_key, _info, _rec, _name, _show, _n, _mod) do { \
79 _info[_n].type = TYPE_UINT8; \
80 strlcpy(_info[_n].name, _key, NAME_MAXVAL); \
81- snprintf(_info[_n].value, VALUE_MAXVAL, "%d", _rec->_name); \
82+ snprintf(_info[_n].value, VALUE_MAXVAL, "%" PRIu8, _rec->_name); \
83 _info[_n].data = &_rec->_name; \
84 _info[_n].data_len = sizeof(_rec->_name); \
85 _info[_n].visible = _show; \
86@@ -87,7 +88,7 @@ static struct idbm *db;
87 #define __recinfo_uint16(_key, _info, _rec, _name, _show, _n, _mod) do { \
88 _info[_n].type = TYPE_UINT16; \
89 strlcpy(_info[_n].name, _key, NAME_MAXVAL); \
90- snprintf(_info[_n].value, VALUE_MAXVAL, "%d", _rec->_name); \
91+ snprintf(_info[_n].value, VALUE_MAXVAL, "%" PRIu16, _rec->_name); \
92 _info[_n].data = &_rec->_name; \
93 _info[_n].data_len = sizeof(_rec->_name); \
94 _info[_n].visible = _show; \
95@@ -98,7 +99,7 @@ static struct idbm *db;
96 #define __recinfo_uint32(_key, _info, _rec, _name, _show, _n, _mod) do { \
97 _info[_n].type = TYPE_UINT32; \
98 strlcpy(_info[_n].name, _key, NAME_MAXVAL); \
99- snprintf(_info[_n].value, VALUE_MAXVAL, "%d", _rec->_name); \
100+ snprintf(_info[_n].value, VALUE_MAXVAL, "%" PRIu32, _rec->_name); \
101 _info[_n].data = &_rec->_name; \
102 _info[_n].data_len = sizeof(_rec->_name); \
103 _info[_n].visible = _show; \
104@@ -1041,7 +1042,7 @@ updated:
105 if (!passwd_done && !strcmp(#_param, name)) { \
106 passwd_done = 1; \
107 name = #_param "_length"; \
108- snprintf(passwd_len, 8, "%d", (int)strlen(value)); \
109+ snprintf(passwd_len, 8, "%.7" PRIi32, (int)strlen(value) & 0xffff); \
110 value = passwd_len; \
111 goto setup_passwd_len; \
112 }
113--
1142.7.4
115
diff --git a/meta-networking/recipes-daemons/iscsi-initiator-utils/iscsi-initiator-utils_2.0.876.bb b/meta-networking/recipes-daemons/iscsi-initiator-utils/iscsi-initiator-utils_2.0.876.bb
index e6a87a38a..48b0783f6 100644
--- a/meta-networking/recipes-daemons/iscsi-initiator-utils/iscsi-initiator-utils_2.0.876.bb
+++ b/meta-networking/recipes-daemons/iscsi-initiator-utils/iscsi-initiator-utils_2.0.876.bb
@@ -14,6 +14,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833"
14SRCREV ?= "bd79e4ed1004a6035d2538a308c5930890421a22" 14SRCREV ?= "bd79e4ed1004a6035d2538a308c5930890421a22"
15 15
16SRC_URI = "git://github.com/open-iscsi/open-iscsi \ 16SRC_URI = "git://github.com/open-iscsi/open-iscsi \
17 file://0001-Fix-i586-build-issues-with-string-length-overflow.patch \
17 file://initd.debian \ 18 file://initd.debian \
18 file://99_iscsi-initiator-utils \ 19 file://99_iscsi-initiator-utils \
19 file://iscsi-initiator \ 20 file://iscsi-initiator \