Web Framework to build REST APIs, Webservices or any HTTP endpoint in C language. Can stream large amount of data, integrate JSON data with Jansson, and create websocket services
Describe the issue
In function ulfius_webservice_dispatcher, at line 657, ulfius_init_websocket(websocket) will be called, and if it fails, line 823, ulfius_clear_websocket will be called, which will lead to a UAF bug.
To be specific
In src/u_websocket.c at line 1728, if ulfius_init_websocket_manager(websocket->websocket_manager) fails, then websocket->websocket_manager will be freed at line 1729 and return U_ERROR.
After return, the branch command at line 657 in src/ulfius.c will go to the else branch and setwebsocket_has_error = 1, which will lead to ulfius_clear_websocket be called at line 823
Describe the issue In function
ulfius_webservice_dispatcher
, at line 657,ulfius_init_websocket(websocket)
will be called, and if it fails, line 823,ulfius_clear_websocket
will be called, which will lead to a UAF bug.To be specific
In
src/u_websocket.c
at line 1728, ifulfius_init_websocket_manager(websocket->websocket_manager)
fails, thenwebsocket->websocket_manager
will be freed at line 1729 and return U_ERROR.After return, the branch command at line 657 in src/ulfius.c will go to the
else
branch and setwebsocket_has_error = 1
, which will lead to ulfius_clear_websocket be called at line 823To Reproduce I found it by static analysis~