[Libwebsockets] [libwebsockets] #110: Crash on Windows in lws_plat_set_socket_options

Trac trac at libwebsockets.org
Wed Apr 15 22:07:05 CEST 2015

#110: Crash on Windows in lws_plat_set_socket_options
 Reporter:  maxkaro                |      Owner:
     Type:  defect                 |     Status:  new
 Priority:  major                  |  Milestone:
Component:  libwebsockets library  |    Version:  1.0
 Keywords:                         |
 A small number of our users experience a crash in lws-plat-win.c in
 lws_plat_set_socket_options. Specifically, here:

 /* Disable Nagle */
         optval = 1;
         tcp_proto = getprotobyname("TCP");
         setsockopt(fd, tcp_proto->p_proto, TCP_NODELAY, (const char
 *)&optval, optlen);

 There is no check for the result of the call to getprotobyname, which may
 return NULL.

 Attached is a diff that would perform then check and return on error.

Ticket URL: <http://libwebsockets.org/trac/libwebsockets/ticket/110>
libwebsockets <http://libwebsockets.org>
libwebsockets C library

More information about the Libwebsockets mailing list