From 5c9dc418ecc3854fa4c4f4af44d8c9f2700892d1 Mon Sep 17 00:00:00 2001 From: DoHyun Pyun Date: Wed, 29 Jul 2015 15:18:54 +0900 Subject: [PATCH] tools/bneptest: Fix not NULL terminating parsed string 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 a7d5815f8..1404252d0 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) { -- 2.47.3