diff options
author | Gustavo A. R. Silva <gustavo@embeddedor.com> | 2019-05-27 14:38:55 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-05-29 03:00:01 -0400 |
commit | 36f18439ea16ebb670720602bfbf47c95a6691d4 (patch) | |
tree | e841b71951dec9c4afe760271144f38c247f3970 | |
parent | be1b5b788829bbfa1cc794fbaa715957f0cce779 (diff) |
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>
-rw-r--r-- | drivers/net/macvlan.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 61550122b563..0ccabde8e9c9 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -831,7 +831,7 @@ static int macvlan_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
831 | struct ifreq ifrr; | 831 | struct ifreq ifrr; |
832 | int err = -EOPNOTSUPP; | 832 | int err = -EOPNOTSUPP; |
833 | 833 | ||
834 | strncpy(ifrr.ifr_name, real_dev->name, IFNAMSIZ); | 834 | strscpy(ifrr.ifr_name, real_dev->name, IFNAMSIZ); |
835 | ifrr.ifr_ifru = ifr->ifr_ifru; | 835 | ifrr.ifr_ifru = ifr->ifr_ifru; |
836 | 836 | ||
837 | switch (cmd) { | 837 | switch (cmd) { |