OSDN Git Service

macvlan: Replace strncpy() by strscpy()
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Mon, 27 May 2019 18:38:55 +0000 (13:38 -0500)
committerDavid S. Miller <davem@davemloft.net>
Wed, 29 May 2019 07:00:01 +0000 (00:00 -0700)
commit36f18439ea16ebb670720602bfbf47c95a6691d4
treee841b71951dec9c4afe760271144f38c247f3970
parentbe1b5b788829bbfa1cc794fbaa715957f0cce779
macvlan: Replace strncpy() by strscpy()

The strncpy() function is being deprecated. Replace it by the safer
strscpy() and fix the following Coverity warning:

"Calling strncpy with a maximum size argument of 16 bytes on destination
array ifrr.ifr_ifrn.ifrn_name of size 16 bytes might leave the destination
string unterminated."

Notice that, unlike strncpy(), strscpy() always null-terminates the
destination string.

Addresses-Coverity-ID: 1445537 ("Buffer not null terminated")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/macvlan.c