Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sock] flush / handle lines during input handling when a telnet SB (renegotation) is received #84

Merged
merged 2 commits into from
May 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -3530,6 +3530,24 @@ static int handle_socket_input(const char *simbuffer, int simlen, const char *en
continue; /* avoid non-telnet processing */

} else if (xsock->fsastate == TN_SB) {
/*
* Flush existing data before handling subnegotiation.
*
* This is needed for the handful of situations where
* things like GMCP/ATCP messages happen to be wrapping
* the incoming text lines rather than a purely out of
* band notification.
*
* Ideally the server would send an EOR or GA here,
* but MUDs use that to terminate the prompt line.
*/
#if WIDECHAR
inbound_decode_str(xsock->buffer, incomingposttelnet,
incomingFSM, 0);
#endif
handle_socket_input_queue_lines(xsock);
flushxsock();

if (xsock->subbuffer->len > RECEIVELIMIT) {
/* It shouldn't take this long; server is broken. Abort. */
SStringcat(xsock->buffer, CS(xsock->subbuffer));
Expand Down
Loading