summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlin Serdean <aserdean@cloudbasesolutions.com>2016-12-13 18:52:35 +0000
committerGurucharan Shetty <guru@ovn.org>2016-12-20 09:24:07 -0800
commite83cb65878fb2ff3de8eaeee0970d0fc9ba104b2 (patch)
tree7282cb7d8c92dd229447a270da12ae87dedb0f90 /lib
parentd7039b9a68522dc32e51ca02b69fbd1da874d118 (diff)
downloadopenvswitch-e83cb65878fb2ff3de8eaeee0970d0fc9ba104b2.tar.gz
windows: Incorrect check while fetching adapter addresses
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 <aserdean@cloudbasesolutions.com> Reported-by: Lior Baram <lior.baram@hpe.com> Acked-by: Sairam Venugopal <vsairam@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/netdev-windows.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/netdev-windows.c b/lib/netdev-windows.c
index f5e809ea0..c2fbe4224 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;