Author: hselasky
Date: Mon May 18 09:17:38 2020
New Revision: 361189
URL: https://svnweb.freebsd.org/changeset/base/361189

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/11/usr.sbin/bluetooth/hccontrol/le.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/bluetooth/hccontrol/le.c
==============================================================================
--- stable/11/usr.sbin/bluetooth/hccontrol/le.c Mon May 18 09:17:05 2020        
(r361188)
+++ stable/11/usr.sbin/bluetooth/hccontrol/le.c Mon May 18 09:17:38 2020        
(r361189)
@@ -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]"

Reply via email to