--- a/libpurple/network.c Wed Oct 19 13:01:43 2016 -0400
+++ b/libpurple/network.c Thu Oct 20 18:20:44 2016 -0400
@@ -639,7 +639,8 @@
WSAQUERYSET *res = (LPWSAQUERYSET) buf;
+ int iteration_count = 0; + while (iteration_count++ < 100) { DWORD size = current_size;
retval = WSALookupServiceNextA(h, 0, &size, res);
if (retval == ERROR_SUCCESS) {
@@ -649,6 +650,10 @@
errorid = WSAGetLastError();
if (errorid == WSAEFAULT) {
+ if (size == 0 || size > 102400) { + purple_debug_warning("network", "Got unexpected NLA buffer size %" G_GUINT32_FORMAT ".\n", (guint32) size); buf = g_realloc(buf, size);
res = (LPWSAQUERYSET) buf;
@@ -729,6 +734,7 @@
WSACOMPLETION completion;
WSAOVERLAPPED overlapped;
@@ -806,7 +812,8 @@
+ while (iteration_count++ < 100) { DWORD size = current_size;
retval = WSALookupServiceNextA(network_change_handle, 0, &size, res);
if (retval == ERROR_SUCCESS) {
@@ -816,6 +823,11 @@
int errorid = WSAGetLastError();
if (errorid == WSAEFAULT) {
+ if (size == 0 || size > 102400) { + purple_timeout_add(0, _print_debug_msg, + g_strdup_printf("Thread got unexpected NLA buffer size %" G_GUINT32_FORMAT ".\n", (guint32) size)); buf = g_realloc(buf, size);
res = (LPWSAQUERYSET) buf;