[PATCH BLUEZ] tools/bneptest: Fix not NULL terminating parsed string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: DoHyun Pyun <dh79.pyun@xxxxxxxxxxx>

This patch prevents the possible not NULL terminating problem.
ifr_name's array size is IFNAMSIZ. So If bridge has IFNAMSIZ size,
the name string will be not NULL terminating.
---
 tools/bneptest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/bneptest.c b/tools/bneptest.c
index a7d5815..1404252 100644
--- a/tools/bneptest.c
+++ b/tools/bneptest.c
@@ -89,7 +89,7 @@ static int set_forward_delay(int sk)
 	struct ifreq ifr;
 
 	memset(&ifr, 0, sizeof(ifr));
-	strncpy(ifr.ifr_name, bridge, IFNAMSIZ);
+	strncpy(ifr.ifr_name, bridge, IFNAMSIZ - 1);
 	ifr.ifr_data = (char *) args;
 
 	if (ioctl(sk, SIOCDEVPRIVATE, &ifr) < 0) {
-- 
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux