[Bluetooth] Fix overflow issue (#4872)
authorWootak Jung <wootak.jung@samsung.com>
Wed, 28 Dec 2022 04:45:11 +0000 (13:45 +0900)
committerGitHub <noreply@github.com>
Wed, 28 Dec 2022 04:45:11 +0000 (13:45 +0900)
src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothLeAdapterImpl.cs

index 77ea945..890c80e 100644 (file)
@@ -337,7 +337,7 @@ namespace Tizen.Network.Bluetooth
             int sizePointerToABC = Marshal.SizeOf(new BluetoothLeServiceDataStruct());
             for (int i = 0; i < _serviceListCount; i++)
             {
-                var svc = (BluetoothLeServiceDataStruct)Marshal.PtrToStructure(new IntPtr(serviceListArray.ToInt32() + (i * sizePointerToABC)), typeof(BluetoothLeServiceDataStruct));
+                var svc = (BluetoothLeServiceDataStruct)Marshal.PtrToStructure(IntPtr.Add(serviceListArray, (i * sizePointerToABC)), typeof(BluetoothLeServiceDataStruct));
                 list.Add(BluetoothUtils.ConvertStructToLeServiceData(svc));
             }