1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

bad index overflow protection of lws_lookup

context->lws_lookup allocation size is
(sizeof(struct libwebsocket *) * context->max_fds).
The maximum index is (context->max_fds - 1).
context->max_fds is not a valid index.
This commit is contained in:
nononame 2014-01-09 20:49:30 +01:00
parent 3b3fa9e208
commit a936d07dba

View file

@ -119,7 +119,7 @@ insert_wsi_socket_into_fds(struct libwebsocket_context *context,
return 1;
}
if (wsi->sock > context->max_fds) {
if (wsi->sock >= context->max_fds) {
lwsl_err("Socket fd %d is too high (%d)\n",
wsi->sock, context->max_fds);
return 1;