From: Razvan Cojocaru <[email protected]> If GetAdaptersAddresses() overflowed on both attempts, find_adapters() freed the buffer, then walked and freed it again. Fail instead.
Change-Id: Ib7c79652a694313fa398852353bd1719f6ce7634 Signed-off-by: Razvan Cojocaru <[email protected]> Acked-by: Frank Lichtenheld <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2361 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2361 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Frank Lichtenheld <[email protected]> diff --git a/src/openvpnmsica/openvpnmsica.c b/src/openvpnmsica/openvpnmsica.c index d2fd9af..0ae8992 100644 --- a/src/openvpnmsica/openvpnmsica.c +++ b/src/openvpnmsica/openvpnmsica.c @@ -183,6 +183,7 @@ } free(pAdapterAdresses); + pAdapterAdresses = NULL; if (ulResult != ERROR_BUFFER_OVERFLOW) { /* MSDN does not mention GetAdaptersAddresses() to set GetLastError(). @@ -193,6 +194,12 @@ goto cleanup_pAdapterList; } } + if (pAdapterAdresses == NULL) + { + msg(M_NONFATAL, "%s: GetAdaptersAddresses() kept overflowing", __FUNCTION__); + uiResult = ERROR_BUFFER_OVERFLOW; + goto cleanup_pAdapterList; + } /* Count adapters. */ size_t adapter_count = 0; _______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
