zhhyu7 opened a new pull request, #4205: URL: https://github.com/apache/nuttx-apps/pull/4205
## Summary When a chatd client sends "quit", _input() -> _online() closes the socket and frees user->telnet. _event_handler() then went on to call telnet_negotiate() on the freed handle. Skip the negotiation once the user has been torn down (user->sock == -1). ## Impact - system/telnet chatd example only. ## Testing sim:dynconns + CONFIG_SYSTEM_TELNET_CHATD on the nuttx0 bridge, built with CONFIG_MM_KASAN_INSTRUMENT_ALL (KASan printed nothing on either build; the use-after-free shows up as chatd exiting). A Python client on the host connects, sets a name, sends a message and "quit"; then a second client does the same. This branch: both sessions complete. ``` nsh> LISTENING ON PORT 2323 $ python3 telnettest.py 10.0.1.2 2323 greeting: b'\xff\xfbVEnter name: \xff\xfb\x01' after name: b'Welcome, tester!\r\n' after msg: b'tester: hello\r\n' after quit: closed=True b'' Connection received. $ python3 telnettest.py 10.0.1.2 2323 greeting: b'\xff\xfbVEnter name: \xff\xfb\x01' after name: b'Welcome, tester!\r\n' after msg: b'tester: hello\r\n' after quit: closed=True b'' Connection received. ``` checkpatch.sh -c -u -m -g passes. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
