ws2_32: Avoid a variable-length array.

This commit is contained in:
Thomas Faber 2014-03-25 16:49:12 +01:00 committed by Alexandre Julliard
parent b1b92046c2
commit 626040b1ac
1 changed files with 3 additions and 1 deletions

View File

@ -3337,12 +3337,13 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level,
#endif #endif
#ifdef HAS_IRDA #ifdef HAS_IRDA
#define MAX_IRDA_DEVICES 10
case WS_SOL_IRLMP: case WS_SOL_IRLMP:
switch(optname) switch(optname)
{ {
case WS_IRLMP_ENUMDEVICES: case WS_IRLMP_ENUMDEVICES:
{ {
static const int MAX_IRDA_DEVICES = 10;
char buf[sizeof(struct irda_device_list) + char buf[sizeof(struct irda_device_list) +
(MAX_IRDA_DEVICES - 1) * sizeof(struct irda_device_info)]; (MAX_IRDA_DEVICES - 1) * sizeof(struct irda_device_info)];
int res; int res;
@ -3402,6 +3403,7 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level,
return SOCKET_ERROR; return SOCKET_ERROR;
} }
break; /* case WS_SOL_IRLMP */ break; /* case WS_SOL_IRLMP */
#undef MAX_IRDA_DEVICES
#endif #endif
/* Levels WS_IPPROTO_TCP and WS_IPPROTO_IP convert directly */ /* Levels WS_IPPROTO_TCP and WS_IPPROTO_IP convert directly */