diff options
author | Joshua Duong <joshuaduong@google.com> | 2022-02-11 22:49:00 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-02-11 22:49:00 +0000 |
commit | 1d08a291f50324c7c86ee0096c87ae9c1fbdc447 (patch) | |
tree | 8aaaeb612b6c3a1e3fb9647f0da35e8cf285a502 | |
parent | 307f4f004b06572ec342cc80eba3a1802f57ffc5 (diff) | |
parent | 95e21bc268e0f3bb4b51baea882393c639d945ef (diff) | |
download | openscreen-1d08a291f50324c7c86ee0096c87ae9c1fbdc447.tar.gz |
[windows] Fix stale pointer dereference. am: 95e21bc268
Original change: https://android-review.googlesource.com/c/platform/external/openscreen/+/1982890
Change-Id: I9d68064705912887a89bc682d7c843c6c8e76f41
-rw-r--r-- | platform/impl/network_interface_win.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/platform/impl/network_interface_win.cc b/platform/impl/network_interface_win.cc index f90d35d2..c3095457 100644 --- a/platform/impl/network_interface_win.cc +++ b/platform/impl/network_interface_win.cc @@ -16,7 +16,6 @@ std::vector<InterfaceInfo> GetAllInterfaces() { constexpr size_t INITIAL_BUFFER_SIZE = 15000; ULONG outbuflen = INITIAL_BUFFER_SIZE; std::vector<unsigned char> charbuf(INITIAL_BUFFER_SIZE); - PIP_ADAPTER_ADDRESSES paddrs = reinterpret_cast<IP_ADAPTER_ADDRESSES*>(charbuf.data()); DWORD ret = NO_ERROR; constexpr int MAX_RETRIES = 5; @@ -25,7 +24,7 @@ std::vector<InterfaceInfo> GetAllInterfaces() { ret = GetAdaptersAddresses(AF_UNSPEC /* get both v4/v6 addrs */, GAA_FLAG_INCLUDE_PREFIX, NULL, - paddrs, + reinterpret_cast<IP_ADAPTER_ADDRESSES*>(charbuf.data()), &outbuflen); if (ret == ERROR_BUFFER_OVERFLOW) { charbuf.resize(outbuflen); @@ -40,7 +39,7 @@ std::vector<InterfaceInfo> GetAllInterfaces() { } std::vector<InterfaceInfo> infos; - auto pcurraddrs = paddrs; + auto pcurraddrs = reinterpret_cast<IP_ADAPTER_ADDRESSES*>(charbuf.data()); while (pcurraddrs != nullptr) { // TODO: return the interfaces OSP_DVLOG << "\tIfIndex=" << pcurraddrs->IfIndex; |