Commit f6a3a521 authored by Lawson Whitney's avatar Lawson Whitney Committed by Alexandre Julliard

Protect against NULL wsaddrlen in ws_sockaddr_alloc.

parent f98c52b1
...@@ -838,12 +838,12 @@ static const struct sockaddr* ws_sockaddr_ws2u(const struct WS_sockaddr* wsaddr, ...@@ -838,12 +838,12 @@ static const struct sockaddr* ws_sockaddr_ws2u(const struct WS_sockaddr* wsaddr,
/* allocates a Unix sockaddr structure to receive the data */ /* allocates a Unix sockaddr structure to receive the data */
inline struct sockaddr* ws_sockaddr_alloc(const struct WS_sockaddr* wsaddr, int* wsaddrlen, int* uaddrlen) inline struct sockaddr* ws_sockaddr_alloc(const struct WS_sockaddr* wsaddr, int* wsaddrlen, int* uaddrlen)
{ {
if (wsaddr==NULL)
return NULL;
if (*wsaddrlen==0) if (*wsaddrlen==0)
*uaddrlen=0; *uaddrlen=0;
else else
*uaddrlen=max(sizeof(struct sockaddr),*wsaddrlen); *uaddrlen=max(sizeof(struct sockaddr),*wsaddrlen);
if (wsaddr==NULL)
return NULL;
return malloc(*uaddrlen); return malloc(*uaddrlen);
} }
......
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