wireguard-apple/Sources/WireGuardKit
John Biggs 12b095470a WireGuardKit: fix incorrect IP address allocation size
According to [1], the `capacity` parameter is specified as "the number
of instances of T in the re-bound region" and not the total size of the
rebound struct.

Without this patch, there are crashes in the extension with the
following error:

  Fatal error: self must be a properly aligned pointer for types Pointee and T`

Since the subsequent line in the code only reads `sizeof(in_addr)` or
`sizeof(in6_addr)` anyway, change the `capacity` parameter to just be a
count of 1.

[1] https://developer.apple.com/documentation/swift/unsafepointer/withmemoryrebound(to:capacity:_:)

Signed-off-by: John Biggs <john.biggs@proton.ch>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-02-08 13:08:40 -03:00
..
Array+ConcurrentMap.swift Global: bump copyright year 2021-06-17 16:56:46 +02:00
DNSResolver.swift Global: bump copyright year 2021-06-17 16:56:46 +02:00
DNSServer.swift Global: bump copyright year 2021-06-17 16:56:46 +02:00
Endpoint.swift Global: bump copyright year 2021-06-17 16:56:46 +02:00
IPAddress+AddrInfo.swift WireGuardKit: fix incorrect IP address allocation size 2023-02-08 13:08:40 -03:00
IPAddressRange.swift Global: bump copyright year 2021-06-17 16:56:46 +02:00
InterfaceConfiguration.swift Global: bump copyright year 2021-06-17 16:56:46 +02:00
PacketTunnelSettingsGenerator.swift Global: bump copyright year 2021-06-17 16:56:46 +02:00
PeerConfiguration.swift Global: bump copyright year 2021-06-17 16:56:46 +02:00
PrivateKey.swift Global: bump copyright year 2021-06-17 16:56:46 +02:00
TunnelConfiguration.swift Global: bump copyright year 2021-06-17 16:56:46 +02:00
WireGuardAdapter.swift Global: bump copyright year 2021-06-17 16:56:46 +02:00