From: Daniel Wagner <[email protected]>

ifr_name is a null terminated buffer, therefore we should
only copy IFNAMSIZ - 1 characters.

Reported by coverty.
---
 src/rtnl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/rtnl.c b/src/rtnl.c
index 80a6edc..ace0461 100644
--- a/src/rtnl.c
+++ b/src/rtnl.c
@@ -104,7 +104,7 @@ static bool wext_interface(char *ifname)
                return false;
 
        memset(&wrq, 0, sizeof(wrq));
-       strncpy(wrq.ifr_name, ifname, IFNAMSIZ);
+       strncpy(wrq.ifr_name, ifname, IFNAMSIZ - 1);
 
        err = ioctl(fd, SIOCGIWNAME, &wrq);
 
-- 
1.8.4.474.g128a96c

_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman

Reply via email to