Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 May 2020 09:17:05 +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: r361188 - stable/12/usr.sbin/bluetooth/hccontrol
Message-ID:  <202005180917.04I9H5rT058283@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Mon May 18 09:17:05 2020
New Revision: 361188
URL: https://svnweb.freebsd.org/changeset/base/361188

Log:
  MFC r360329:
  Properly update AD field length in hccontrol(8).
  
  While at it use strtol() instead of atoi() to support hexadecimal
  numbers aswell as 10-base numbers.
  
  Submitted by:	Marc Veldman <marc@bumblingdork.com>
  PR:		245899
  Sponsored by:	Mellanox Technologies

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

Modified: stable/12/usr.sbin/bluetooth/hccontrol/le.c
==============================================================================
--- stable/12/usr.sbin/bluetooth/hccontrol/le.c	Mon May 18 09:16:17 2020	(r361187)
+++ stable/12/usr.sbin/bluetooth/hccontrol/le.c	Mon May 18 09:17:05 2020	(r361188)
@@ -172,13 +172,13 @@ parse_param(int argc, char *argv[], char *buf, int *le
 				goto done;
 			curbuf[0] = 2;
 			curbuf[1] = 1;
-			curbuf[2] = atoi(optarg);
+			curbuf[2] = (uint8_t)strtol(optarg, NULL, 16);
 			curbuf += 3;
 			break;
 		case 'u':
-			lenpos = buf;
 			if ((buf+2) >= buflast)
 				goto done;
+			lenpos = curbuf;
 			curbuf[1] = 2;
 			*lenpos = 1;
 			curbuf += 2;
@@ -189,6 +189,7 @@ parse_param(int argc, char *argv[], char *buf, int *le
 				curbuf[0] = value &0xff;
 				curbuf[1] = (value>>8)&0xff;
 				curbuf += 2;
+				*lenpos += 2;
 			}
 				
 		}



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