diff options
author | Lee Duncan <lduncan@suse.com> | 2018-03-21 16:43:33 -0700 |
---|---|---|
committer | Lee Duncan <lduncan@suse.com> | 2018-03-21 18:48:46 -0700 |
commit | 7fd4eb9313154f3b3458ea07d6a12f0be26d2a4e (patch) | |
tree | c33c68014438f9e251b38c42a2280aeb3573a33b /iscsiuio | |
parent | 273661c9c8d877f81d2096797bae6d95987b1d2e (diff) | |
download | open-iscsi-7fd4eb9313154f3b3458ea07d6a12f0be26d2a4e.tar.gz |
Use correct size when copying nic name.
The incorrect length was being used to copy
the NIC name.
Found by gcc-8, which gave this error:
> [ 19s] nic_utils.c: In function 'nic_util_enable_disable_multicast':
> [ 19s] nic_utils.c:308:9: warning: argument to 'sizeof' in 'strncpy'
> call is the same expression as the source; did you mean to
> use the size of the destination? [-Wsizeof-pointer-memaccess]
> [ 19s] sizeof(nic->eth_device_name));
> [ 19s] ^
Diffstat (limited to 'iscsiuio')
-rw-r--r-- | iscsiuio/src/unix/nic_utils.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/iscsiuio/src/unix/nic_utils.c b/iscsiuio/src/unix/nic_utils.c index e2f2943..786f2a4 100644 --- a/iscsiuio/src/unix/nic_utils.c +++ b/iscsiuio/src/unix/nic_utils.c @@ -305,7 +305,7 @@ static int nic_util_enable_disable_multicast(nic_t *nic, uint32_t cmd) /* Prepare the request */ memset(&ifr, 0, sizeof(ifr)); strncpy(ifr.ifr_name, nic->eth_device_name, - sizeof(nic->eth_device_name)); + sizeof(ifr.ifr_name)); memcpy(ifr.ifr_hwaddr.sa_data, multicast_addr.addr, ETH_ALEN); fd = socket(AF_INET, SOCK_DGRAM, 0); |