Date: Sun, 26 Apr 2020 08:31:08 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360329 - head/usr.sbin/bluetooth/hccontrol Message-ID: <202004260831.03Q8V8HG098435@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Sun Apr 26 08:31:08 2020 New Revision: 360329 URL: https://svnweb.freebsd.org/changeset/base/360329 Log: 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 MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/usr.sbin/bluetooth/hccontrol/le.c Modified: head/usr.sbin/bluetooth/hccontrol/le.c ============================================================================== --- head/usr.sbin/bluetooth/hccontrol/le.c Sun Apr 26 00:41:29 2020 (r360328) +++ head/usr.sbin/bluetooth/hccontrol/le.c Sun Apr 26 08:31:08 2020 (r360329) @@ -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?202004260831.03Q8V8HG098435>