Blame SOURCES/open-iscsi-2.0.876-6-Use-correct-size-when-copying-nic-name.patch

47585c
From 7fd4eb9313154f3b3458ea07d6a12f0be26d2a4e Mon Sep 17 00:00:00 2001
47585c
From: Lee Duncan <lduncan@suse.com>
47585c
Date: Wed, 21 Mar 2018 16:43:33 -0700
47585c
Subject: [PATCH] Use correct size when copying nic name.
47585c
47585c
The incorrect length was being used to copy
47585c
the NIC name.
47585c
47585c
Found by gcc-8, which gave this error:
47585c
>    [   19s] nic_utils.c: In function 'nic_util_enable_disable_multicast':
47585c
>    [   19s] nic_utils.c:308:9: warning: argument to 'sizeof' in 'strncpy'
47585c
>             call is the same expression as the source; did you mean to
47585c
>             use the size of the destination? [-Wsizeof-pointer-memaccess]
47585c
>    [   19s]    sizeof(nic->eth_device_name));
47585c
>    [   19s]          ^
47585c
---
47585c
 iscsiuio/src/unix/nic_utils.c | 2 +-
47585c
 1 file changed, 1 insertion(+), 1 deletion(-)
47585c
47585c
diff --git a/iscsiuio/src/unix/nic_utils.c b/iscsiuio/src/unix/nic_utils.c
47585c
index e2f294389840..786f2a4d5b5d 100644
47585c
--- a/iscsiuio/src/unix/nic_utils.c
47585c
+++ b/iscsiuio/src/unix/nic_utils.c
47585c
@@ -305,7 +305,7 @@ static int nic_util_enable_disable_multicast(nic_t *nic, uint32_t cmd)
47585c
 	/* Prepare the request */
47585c
 	memset(&ifr, 0, sizeof(ifr));
47585c
 	strncpy(ifr.ifr_name, nic->eth_device_name,
47585c
-		sizeof(nic->eth_device_name));
47585c
+		sizeof(ifr.ifr_name));
47585c
 	memcpy(ifr.ifr_hwaddr.sa_data, multicast_addr.addr, ETH_ALEN);
47585c
 
47585c
 	fd = socket(AF_INET, SOCK_DGRAM, 0);
47585c
-- 
47585c
2.17.2
47585c