Checking for ERROR_INSUFFICIENT_BUFFER is incorrect per MSFT documentation: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365915(v=vs.85).aspx
Also, the initial call to GetAdaptersAddresses was wrong. In the case of a successful return 'all_addr' was not allocated leading to a crash. Signed-off-by: Alin Gabriel Serdean <[email protected]> Reported-by: Lior Baram <[email protected]> --- lib/netdev-windows.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/netdev-windows.c b/lib/netdev-windows.c index f5e809e..c2fbe42 100644 --- a/lib/netdev-windows.c +++ b/lib/netdev-windows.c @@ -425,16 +425,16 @@ netdev_windows_get_next_hop(const struct in_addr *host, { uint32_t ret_val = 0; /* The buffer length of all addresses */ - uint32_t buffer_length = 1000; + uint32_t buffer_length = 0; PIP_ADAPTER_ADDRESSES all_addr = NULL; PIP_ADAPTER_ADDRESSES cur_addr = NULL; ret_val = GetAdaptersAddresses(AF_INET, GAA_FLAG_INCLUDE_PREFIX | GAA_FLAG_INCLUDE_GATEWAYS, - NULL, all_addr, &buffer_length); + NULL, NULL, &buffer_length); - if (ret_val != ERROR_INSUFFICIENT_BUFFER ) { + if (ret_val != ERROR_BUFFER_OVERFLOW ) { VLOG_ERR("Call to GetAdaptersAddresses failed with error: %s", ovs_format_message(ret_val)); return ENXIO; -- 2.10.2.windows.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
