mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-13 11:38:19 +00:00
c9f462b70d
4901: Fix websocket crash on client connect r=def- a=srdante Currently when a client tries to connect using websocket it will throw a segmentation fault. This is happening because of the std::string is trying to convert a char array with empty values to string directly. ``` ==2305850== Invalid write of size 8 ==2305850== at 0x48401E9: memcpy@GLIBC_2.2.5 (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) ==2305850== by 0x1E762D: websocket_callback(lws*, lws_callback_reasons, void*, void*, unsigned long) (in /home/ploi/ddnet/build/DDNet-Server) ==2305850== by 0x4C7FB98: ??? (in /usr/lib/x86_64-linux-gnu/libwebsockets.so.15) ==2305850== by 0x4C82F61: ??? (in /usr/lib/x86_64-linux-gnu/libwebsockets.so.15) ==2305850== by 0x4C83206: ??? (in /usr/lib/x86_64-linux-gnu/libwebsockets.so.15) ==2305850== by 0x4C9B84B: ??? (in /usr/lib/x86_64-linux-gnu/libwebsockets.so.15) ==2305850== by 0x4C7E0B4: ??? (in /usr/lib/x86_64-linux-gnu/libwebsockets.so.15) ==2305850== by 0x4C7E5C9: ??? (in /usr/lib/x86_64-linux-gnu/libwebsockets.so.15) ==2305850== by 0x4C77EC6: lws_service_fd_tsi (in /usr/lib/x86_64-linux-gnu/libwebsockets.so.15) ==2305850== by 0x4C9728A: ??? (in /usr/lib/x86_64-linux-gnu/libwebsockets.so.15) ==2305850== by 0x4C974CC: ??? (in /usr/lib/x86_64-linux-gnu/libwebsockets.so.15) ==2305850== by 0x4C78114: lws_service (in /usr/lib/x86_64-linux-gnu/libwebsockets.so.15) ==2305850== Address 0x0 is not stack'd, malloc'd or (recently) free'd ``` <!-- What is the motivation for the changes of this pull request --> ## Checklist - [x] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [x] Tested in combination with possibly related configuration options - [ ] Written a unit test if it works standalone, system.c especially - [ ] Considered possible null pointers and out of bounds array indexing - [x] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: srdante <minidantebtc@gmail.com> |
||
---|---|---|
.. | ||
assertion_logger.cpp | ||
assertion_logger.h | ||
compression.cpp | ||
compression.h | ||
config.cpp | ||
config.h | ||
config_variables.h | ||
console.cpp | ||
console.h | ||
csv.cpp | ||
csv.h | ||
datafile.cpp | ||
datafile.h | ||
demo.cpp | ||
demo.h | ||
econ.cpp | ||
econ.h | ||
engine.cpp | ||
fifo.cpp | ||
fifo.h | ||
filecollection.cpp | ||
filecollection.h | ||
global_uuid_manager.cpp | ||
huffman.cpp | ||
huffman.h | ||
image_manipulation.cpp | ||
image_manipulation.h | ||
jobs.cpp | ||
jobs.h | ||
json.cpp | ||
json.h | ||
kernel.cpp | ||
linereader.cpp | ||
linereader.h | ||
map.cpp | ||
map.h | ||
masterserver.cpp | ||
memheap.cpp | ||
memheap.h | ||
netban.cpp | ||
netban.h | ||
network.cpp | ||
network.h | ||
network_client.cpp | ||
network_conn.cpp | ||
network_console.cpp | ||
network_console_conn.cpp | ||
network_server.cpp | ||
packer.cpp | ||
packer.h | ||
protocol.h | ||
protocol_ex.cpp | ||
protocol_ex.h | ||
protocol_ex_msgs.h | ||
ringbuffer.cpp | ||
ringbuffer.h | ||
serverinfo.cpp | ||
serverinfo.h | ||
snapshot.cpp | ||
snapshot.h | ||
storage.cpp | ||
teehistorian_ex.cpp | ||
teehistorian_ex.h | ||
teehistorian_ex_chunks.h | ||
uuid_manager.cpp | ||
uuid_manager.h | ||
video.cpp | ||
video.h | ||
websockets.cpp | ||
websockets.h |