linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BLUEZ] tools/bneptest: Fix not NULL terminating parsed string
@ 2015-07-29  6:18 Dohyun Pyun
  2015-07-29  7:29 ` Szymon Janc
  0 siblings, 1 reply; 2+ messages in thread
From: Dohyun Pyun @ 2015-07-29  6:18 UTC (permalink / raw)
  To: linux-bluetooth, grzegorz.kolodziejczyk; +Cc: steve.jun, DoHyun Pyun

From: DoHyun Pyun <dh79.pyun@samsung.com>

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH BLUEZ] tools/bneptest: Fix not NULL terminating parsed string
  2015-07-29  6:18 [PATCH BLUEZ] tools/bneptest: Fix not NULL terminating parsed string Dohyun Pyun
@ 2015-07-29  7:29 ` Szymon Janc
  0 siblings, 0 replies; 2+ messages in thread
From: Szymon Janc @ 2015-07-29  7:29 UTC (permalink / raw)
  To: Dohyun Pyun; +Cc: linux-bluetooth, grzegorz.kolodziejczyk, steve.jun

Hi Dohyun Pyun,

On Wednesday 29 of July 2015 15:18:54 Dohyun Pyun wrote:
> From: DoHyun Pyun <dh79.pyun@samsung.com>
> 
> 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) {

Applied, thanks.

-- 
BR
Szymon Janc

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-29  7:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-29  6:18 [PATCH BLUEZ] tools/bneptest: Fix not NULL terminating parsed string Dohyun Pyun
2015-07-29  7:29 ` Szymon Janc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).