svnno****@sourc*****
svnno****@sourc*****
2015年 5月 1日 (金) 22:06:56 JST
Revision: 5844 http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5844 Author: yutakapon Date: 2015-05-01 22:06:54 +0900 (Fri, 01 May 2015) Log Message: ----------- teraterm.iniの CipherOrder, KexOrder, MacOrder, CompOrderの 先頭が"0"だった場合に、BOFでプログラムが落ちないようにした。 Modified Paths: -------------- trunk/ttssh2/ttxssh/ssh.c -------------- next part -------------- Modified: trunk/ttssh2/ttxssh/ssh.c =================================================================== --- trunk/ttssh2/ttxssh/ssh.c 2015-05-01 07:44:21 UTC (rev 5843) +++ trunk/ttssh2/ttxssh/ssh.c 2015-05-01 13:06:54 UTC (rev 5844) @@ -4363,7 +4363,8 @@ strncat_s(buf, sizeof(buf), c_str, _TRUNCATE); } len = strlen(buf); - buf[len - 1] = '\0'; // get rid of comma + if (len > 0) + buf[len - 1] = '\0'; // get rid of comma myproposal[PROPOSAL_ENC_ALGS_CTOS] = buf; // Client To Server myproposal[PROPOSAL_ENC_ALGS_STOC] = buf; // Server To Client } @@ -4390,7 +4391,8 @@ strncat_s(buf, sizeof(buf), ",", _TRUNCATE); } len = strlen(buf); - buf[len - 1] = '\0'; // get rid of comma + if (len > 0) + buf[len - 1] = '\0'; // get rid of comma // \x88\xB3\x8Fk\x8Ew\x92肪\x82Ȃ\xA2\x8Fꍇ\x82́A\x88\xB3\x8Fk\x83\x8C\x83x\x83\x8B\x82\xF0\x8C\x8F\x82Ƀ[\x83\x8D\x82ɂ\xB7\x82\xE9\x81B if (buf[0] == '\0') { @@ -4428,7 +4430,8 @@ strncat_s(buf, sizeof(buf), ",", _TRUNCATE); } len = strlen(buf); - buf[len - 1] = '\0'; // get rid of comma + if (len > 0) + buf[len - 1] = '\0'; // get rid of comma myproposal[PROPOSAL_KEX_ALGS] = buf; } @@ -4481,7 +4484,8 @@ strncat_s(buf, sizeof(buf), ",", _TRUNCATE); } len = strlen(buf); - buf[len - 1] = '\0'; // get rid of comma + if (len > 0) + buf[len - 1] = '\0'; // get rid of comma myproposal[PROPOSAL_MAC_ALGS_CTOS] = buf; myproposal[PROPOSAL_MAC_ALGS_STOC] = buf; }