diff options
author | Lee Duncan <lduncan@suse.com> | 2021-09-18 16:10:50 -0700 |
---|---|---|
committer | Lee Duncan <lduncan@suse.com> | 2021-09-18 16:10:50 -0700 |
commit | 424d5967e94f6adf4c0669d390779af8da0bef20 (patch) | |
tree | cc82616e6bd93d509dac13b4bc4d76613901317c /libopeniscsiusr | |
parent | 20d0aa96f2170339b1967f4be81e9c5042bbce03 (diff) | |
download | open-iscsi-424d5967e94f6adf4c0669d390779af8da0bef20.tar.gz |
Fix compiler error introduced with recent IPv6 commit.
Commit 76350316de38 ("Handle IPv6 interfaces correctly.") added
a string copy that creates this gcc-11 error message:
> gcc-11 -O2 -g -Wall -Werror -Wextra -fvisibility=hidden -fPIC -I/usr/include/kmod -c -o idbm.o idbm.c
> idbm.c: In function ‘_idbm_node_rec_link’:
> idbm.c:999:17: error: ‘strncpy’ specified bound 65 equals destination size [-Werror=stringop-truncation]
> 999 | strncpy((*node).iface.name, iface_name, ISCSI_MAX_IFACE_LEN);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
So copy one less character, maximum.
Diffstat (limited to 'libopeniscsiusr')
-rw-r--r-- | libopeniscsiusr/idbm.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libopeniscsiusr/idbm.c b/libopeniscsiusr/idbm.c index b2524ed..6f57e45 100644 --- a/libopeniscsiusr/idbm.c +++ b/libopeniscsiusr/idbm.c @@ -996,7 +996,7 @@ static void _idbm_node_rec_link(struct iscsi_node *node, struct idbm_rec *recs, /* use the interface name passed in, if any */ if (iface_name) - strncpy((*node).iface.name, iface_name, ISCSI_MAX_IFACE_LEN); + strncpy((*node).iface.name, iface_name, ISCSI_MAX_IFACE_LEN-1); /* * Note: because we do not add the iface.iscsi_ifacename to |