Skip to content

Commit c0b2149

Browse files
committed
Fixed bug in telnet negotiation of terminal type
1 parent d8433a7 commit c0b2149

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

telnet_phases.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -727,16 +727,16 @@ void CMUSHclientDoc::Handle_TELOPT_TERMINAL_TYPE ()
727727
// see: RFC 930 and RFC 1060
728728
// also see: http://tintin.sourceforge.net/mtts/
729729

730-
unsigned char p1 [] = { IAC, SB, TELOPT_TERMINAL_TYPE, TTYPE_IS };
731-
unsigned char p2 [] = { IAC, SE };
730+
unsigned char p1 [4] = { IAC, SB, TELOPT_TERMINAL_TYPE, TTYPE_IS };
731+
unsigned char p2 [2] = { IAC, SE };
732732
unsigned char sResponse [40];
733733
int iLength = 0;
734734

735735
// build up response, eg. IAC, SB, TELOPT_TERMINAL_TYPE, 0, "MUSHCLIENT", IAC, SE
736736

737737
// preamble
738-
memcpy (sResponse, p1, sizeof p1);
739-
iLength += sizeof p1;
738+
memcpy (sResponse, p1, 4);
739+
iLength += 4;
740740

741741
// ensure max of 20 so we don't overflow the field
742742
CString strTemp;
@@ -792,12 +792,12 @@ void CMUSHclientDoc::Handle_TELOPT_TERMINAL_TYPE ()
792792

793793
} // end of switch
794794

795-
memcpy (&sResponse [iLength], strTemp, strTemp.GetLength ());
795+
memcpy (&sResponse [iLength], (LPCTSTR) strTemp, strTemp.GetLength ());
796796
iLength += strTemp.GetLength ();
797797

798798
// postamble
799-
memcpy (&sResponse [iLength], p2, sizeof p2);
800-
iLength += sizeof p2;
799+
memcpy (&sResponse [iLength], p2, 2);
800+
iLength += 2;
801801

802802
SendPacket (sResponse, iLength);
803803

0 commit comments

Comments
 (0)