diff options
author | Guoqing Jiang <gqjiang@suse.com> | 2018-10-19 12:08:22 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-10-22 19:25:32 -0700 |
commit | 29e270fc32192e7729057963ae7120663856c93e (patch) | |
tree | 2d0c82a21d7fd117bef62e8f17b357f9ab59f0a9 /net/tipc/node.c | |
parent | a1930a9877d66e9333fc1b1ceeec1ab54591a91f (diff) | |
download | linux-29e270fc32192e7729057963ae7120663856c93e.tar.bz2 |
tipc: use destination length for copy string
Got below warning with gcc 8.2 compiler.
net/tipc/topsrv.c: In function ‘tipc_topsrv_start’:
net/tipc/topsrv.c:660:2: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
strncpy(srv->name, name, strlen(name) + 1);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/tipc/topsrv.c:660:27: note: length computed here
strncpy(srv->name, name, strlen(name) + 1);
^~~~~~~~~~~~
So change it to correct length and use strscpy.
Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/node.c')
0 files changed, 0 insertions, 0 deletions