Skip to content

Commit 2c936e0

Browse files
committed
Use proper sized integer for ioctlsocket on Win32 (case 990979)
Windows expects a 32-bit unsigned long in this API. Previously we passed a 64-bit value and the actual amount was stored in the wrong bits.
1 parent 7e21310 commit 2c936e0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mono/metadata/w32socket-win32.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,10 @@ gint
330330
mono_w32socket_get_available (SOCKET sock, guint64 *amount)
331331
{
332332
gint ret;
333+
u_long amount_long = 0;
333334
MONO_ENTER_GC_SAFE;
334-
ret = ioctlsocket (sock, FIONREAD, (int*) amount);
335+
ret = ioctlsocket (sock, FIONREAD, &amount_long);
336+
*amount = amount_long;
335337
MONO_EXIT_GC_SAFE;
336338
return ret;
337339
}

0 commit comments

Comments
 (0)