Commit 0875d6e9 authored by Stephen Langasek's avatar Stephen Langasek Committed by Alexandre Julliard

Prevent segfault in setsockopt when optname is SO_LINGER and optval is

null.
parent 882c1bef
......@@ -1477,10 +1477,12 @@ INT32 WINAPI WINSOCK_setsockopt32(SOCKET16 s, INT32 level, INT32 optname,
struct linger linger;
convert_sockopt(&level, &optname);
if (optname == SO_LINGER) {
if (optname == SO_LINGER && optval) {
/* yes, uses unsigned short in both win16/win32 */
linger.l_onoff = ((UINT16*)optval)[0];
linger.l_linger = ((UINT16*)optval)[1];
/* FIXME: what is documented behavior if SO_LINGER optval
is null?? */
optval = (char*)&linger;
optlen = sizeof(struct linger);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment