diff options
Diffstat (limited to 'meta-networking/recipes-daemons/iscsi-initiator-utils/files/0002-libopeniscsiusr-iface-Set-strncpy-bounds-to-not-over.patch')
-rw-r--r-- | meta-networking/recipes-daemons/iscsi-initiator-utils/files/0002-libopeniscsiusr-iface-Set-strncpy-bounds-to-not-over.patch | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/meta-networking/recipes-daemons/iscsi-initiator-utils/files/0002-libopeniscsiusr-iface-Set-strncpy-bounds-to-not-over.patch b/meta-networking/recipes-daemons/iscsi-initiator-utils/files/0002-libopeniscsiusr-iface-Set-strncpy-bounds-to-not-over.patch deleted file mode 100644 index b7c87f4163..0000000000 --- a/meta-networking/recipes-daemons/iscsi-initiator-utils/files/0002-libopeniscsiusr-iface-Set-strncpy-bounds-to-not-over.patch +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | From 56a56567d4f334b119e60c4ef0ad87edf7b77609 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Fri, 1 Jun 2018 18:46:19 -0700 | ||
4 | Subject: [PATCH] libopeniscsiusr/iface: Set strncpy bounds to not overflow | ||
5 | |||
6 | Fixes warnings found by gcc8 | ||
7 | |||
8 | iface.c:492:47: error: '%s' directive output may be truncated writing up to 4095 bytes into a region of size 4073 [-Werror=format-truncation=] | ||
9 | |||
10 | iface.c:140:3: note: in expansion of macro '_strncpy' | ||
11 | _strncpy((*iface)->transport_name, proc_name + strlen("iscsi_"), | ||
12 | ^~~~~~~~ | ||
13 | |||
14 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
15 | --- | ||
16 | libopeniscsiusr/iface.c | 5 +++-- | ||
17 | 1 file changed, 3 insertions(+), 2 deletions(-) | ||
18 | |||
19 | diff --git a/libopeniscsiusr/iface.c b/libopeniscsiusr/iface.c | ||
20 | index 955395d..d33363e 100644 | ||
21 | --- a/libopeniscsiusr/iface.c | ||
22 | +++ b/libopeniscsiusr/iface.c | ||
23 | @@ -138,7 +138,7 @@ int _iscsi_iface_get_from_sysfs(struct iscsi_context *ctx, uint32_t host_id, | ||
24 | |||
25 | if (strncmp(proc_name, "iscsi_", strlen("iscsi_")) == 0) | ||
26 | _strncpy((*iface)->transport_name, proc_name + strlen("iscsi_"), | ||
27 | - sizeof((*iface)->transport_name) / sizeof(char)); | ||
28 | + sizeof((*iface)->transport_name) / sizeof(char) - 1); | ||
29 | else | ||
30 | _strncpy((*iface)->transport_name, proc_name, | ||
31 | sizeof((*iface)->transport_name) / sizeof(char)); | ||
32 | @@ -489,7 +489,8 @@ static int _fill_hw_iface_from_sys(struct iscsi_context *ctx, | ||
33 | |||
34 | sysfs_iface_dir_path = malloc(PATH_MAX); | ||
35 | _alloc_null_check(ctx, sysfs_iface_dir_path, rc, out); | ||
36 | - snprintf(sysfs_iface_dir_path, PATH_MAX, "%s/%s", | ||
37 | + sysfs_iface_dir_path[PATH_MAX+strlen(_ISCSI_SYS_IFACE_DIR)] = '\0'; | ||
38 | + snprintf(sysfs_iface_dir_path, PATH_MAX+strlen(_ISCSI_SYS_IFACE_DIR)+1, "%s/%s", | ||
39 | _ISCSI_SYS_IFACE_DIR, iface_kern_id); | ||
40 | |||
41 | _good(_sysfs_prop_get_str(ctx, sysfs_iface_dir_path, | ||