[Ttssh2-commit] [6963] telnet 接続時、端末の幅 / 高さが 255 の時に端末サイズがサーバに伝わらないのを修正 #37605

scmno****@osdn***** scmno****@osdn*****
2017年 10月 27日 (金) 18:40:53 JST


Revision: 6963
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/6963
Author:   doda
Date:     2017-10-27 18:40:53 +0900 (Fri, 27 Oct 2017)
Log Message:
-----------
telnet 接続時、端末の幅/高さが 255 の時に端末サイズがサーバに伝わらないのを修正 #37605

telnet サブオプションで値に 255 を使う時は 255(IAC) を二つ連続で送る必要がある。

RFC 855:
|   Finally, if parameters in an option "subnegotiation" include a byte
|   with a value of 255, it is necessary to double this byte in
|   accordance the general TELNET rules.

HIBYTE の方が 255 になる事はないだろうが、念の為対応しておく。

Ticket Links:
------------
    http://sourceforge.jp/projects/ttssh2/tracker/detail/37605

Modified Paths:
--------------
    trunk/teraterm/teraterm/telnet.c

-------------- next part --------------
Modified: trunk/teraterm/teraterm/telnet.c
===================================================================
--- trunk/teraterm/teraterm/telnet.c	2017-10-27 09:40:50 UTC (rev 6962)
+++ trunk/teraterm/teraterm/telnet.c	2017-10-27 09:40:53 UTC (rev 6963)
@@ -176,16 +176,27 @@
 	TmpBuff[i++] = IAC;
 	TmpBuff[i++] = SB;
 	TmpBuff[i++] = NAWS;
+
+	if (HIBYTE(tr.WinSize.x) == IAC) {
+		TmpBuff[i++] = IAC;
+	}
 	TmpBuff[i++] = HIBYTE(tr.WinSize.x);
-//	if (LOBYTE(tr.WinSize.x) == IAC) {
-//		tr.SendBackBuff[i++] = IAC;
-//	}
+
+	if (LOBYTE(tr.WinSize.x) == IAC) {
+		TmpBuff[i++] = IAC;
+	}
 	TmpBuff[i++] = LOBYTE(tr.WinSize.x);
+
+	if (HIBYTE(tr.WinSize.y) == IAC) {
+		TmpBuff[i++] = IAC;
+	}
 	TmpBuff[i++] = HIBYTE(tr.WinSize.y);
-//	if (LOBYTE(tr.WinSize.y) == IAC) {
-//		tr.SendBackBuff[i++] = IAC;
-//	}
+
+	if (LOBYTE(tr.WinSize.y) == IAC) {
+		TmpBuff[i++] = IAC;
+	}
 	TmpBuff[i++] = LOBYTE(tr.WinSize.y);
+
 	TmpBuff[i++] = IAC;
 	TmpBuff[i++] = SE;
 



Ttssh2-commit メーリングリストの案内