Skip to content
Snippets Groups Projects
Commit 0a78d39d authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Fix handling of broken CRLF pairs in RIP mode

If telnet binary mode is enabled (the new default), and a CR and LF
come in on separate recv() calls, the RIP parser would stop at the
CR, and pass the LF back to the ANSI parser.

Ah, dura-bbs.net, always pushing the limits.
parent 7b3873e5
No related branches found
No related tags found
No related merge requests found
Pipeline #6969 passed
...@@ -86,7 +86,7 @@ enum rip_state { ...@@ -86,7 +86,7 @@ enum rip_state {
   
// Back to normal state definitions // Back to normal state definitions
   
/*23*/, /*18*/,
RIP_STATE_CR // Got a CR RIP_STATE_CR // Got a CR
, ,
RIP_STATE_ESC // Got an ESC RIP_STATE_ESC // Got an ESC
...@@ -15604,7 +15604,10 @@ handle_rip_line(BYTE *buf, unsigned *blen, unsigned *pos, size_t *rip_start, uns ...@@ -15604,7 +15604,10 @@ handle_rip_line(BYTE *buf, unsigned *blen, unsigned *pos, size_t *rip_start, uns
remainder = *blen - *pos - 1; remainder = *blen - *pos - 1;
} }
else { else {
remove = 0; if ((*blen > 0) && (rip.state == RIP_STATE_CR) && (buf[0] == '\n'))
remove = 1;
else
remove = 0;
remainder = *blen; remainder = *blen;
} }
if (ns == RIP_STATE_FLUSHING) { if (ns == RIP_STATE_FLUSHING) {
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment