svnno****@sourc*****
svnno****@sourc*****
2017年 5月 29日 (月) 07:57:32 JST
Revision: 6752 http://sourceforge.jp/projects/ttssh2/scm/svn/commits/6752 Author: maya Date: 2017-05-29 07:57:32 +0900 (Mon, 29 May 2017) Log Message: ----------- NULL(削除した暗号化方式名)とstrcmpで比較して落ちるのを修正 見つからなかった場合はNULLではなく空文字列のほうが安全? Modified Paths: -------------- trunk/ttssh2/ttxssh/ttxssh.c -------------- next part -------------- Modified: trunk/ttssh2/ttxssh/ttxssh.c =================================================================== --- trunk/ttssh2/ttxssh/ttxssh.c 2017-05-28 06:41:22 UTC (rev 6751) +++ trunk/ttssh2/ttxssh/ttxssh.c 2017-05-28 22:57:32 UTC (rev 6752) @@ -3064,9 +3064,11 @@ if (len > 0 && len < sizeof(buf)) { /* should always be true */ buf[0] = 0; SendMessage(cipherControl, LB_GETTEXT, i, (LPARAM) buf); - for (j = 0; - j <= SSH_CIPHER_MAX - && strcmp(buf, get_cipher_name(j)) != 0; j++) { + for (j = 0; j <= SSH_CIPHER_MAX; j++) { + char *cipher_name = get_cipher_name(j); + if (cipher_name != NULL && strcmp(buf, cipher_name) == 0) { + break; + } } if (j <= SSH_CIPHER_MAX) { buf2[buf2index] = '0' + j;