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 <[email protected]> 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; } } _______________________________________________ [email protected] mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "[email protected]"
