[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20181022.192558.1512536195523667509.davem@davemloft.net>
Date: Mon, 22 Oct 2018 19:25:58 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: gqjiang@...e.com
Cc: jon.maloy@...csson.com, ying.xue@...driver.com,
netdev@...r.kernel.org, tipc-discussion@...ts.sourceforge.net
Subject: Re: [PATCH] tipc: use destination length for copy string
From: Guoqing Jiang <gqjiang@...e.com>
Date: Fri, 19 Oct 2018 12:08:22 +0800
> 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@...e.com>
Applied.
Powered by blists - more mailing lists