Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 May 2020 08:52:07 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r361160 - stable/12/usr.sbin/bluetooth/hccontrol
Message-ID:  <202005180852.04I8q7Q7043674@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Mon May 18 08:52:06 2020
New Revision: 361160
URL: https://svnweb.freebsd.org/changeset/base/361160

Log:
  MFC r360095:
  Fix cut and paste off-by-one error in hccontrol(8).
  Make sure strncpy() doesn't write beyond its given buffer.
  
  PR:		245739
  Sponsored by:	Mellanox Technologies

Modified:
  stable/12/usr.sbin/bluetooth/hccontrol/util.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/bluetooth/hccontrol/util.c
==============================================================================
--- stable/12/usr.sbin/bluetooth/hccontrol/util.c	Mon May 18 08:46:53 2020	(r361159)
+++ stable/12/usr.sbin/bluetooth/hccontrol/util.c	Mon May 18 08:52:06 2020	(r361160)
@@ -134,6 +134,7 @@ hci_hmode2str(int mode, char *buffer, int size)
 		int	n;
 
 		memset(buffer, 0, size);
+		size--;
 		for (n = 0; n < SIZE(t); n++) {
 			int	len = strlen(buffer);
 
@@ -347,6 +348,7 @@ hci_features2str(uint8_t *features, char *buffer, int 
 
 		memset(buffer, 0, size);
 		len1 = 0;
+		size--;
 
 		for (n = 0; n < SIZE(t); n++) {
 			for (i = 0; i < SIZE(t[n]); i++) {
@@ -460,6 +462,7 @@ hci_le_features2str(uint8_t *features, char *buffer, i
 
 		memset(buffer, 0, size);
 		len1 = 0;
+		size--;
 
 		for (n = 0; n < SIZE(t); n++) {
 			for (i = 0; i < SIZE(t[n]); i++) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005180852.04I8q7Q7043674>