[Ttssh2-commit] [4492] パケット圧縮を有効にした状態で、BOFが発生していた問題を修正した。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 6月 10日 (金) 00:25:43 JST


Revision: 4492
          http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=4492
Author:   yutakapon
Date:     2011-06-10 00:25:43 +0900 (Fri, 10 Jun 2011)

Log Message:
-----------
パケット圧縮を有効にした状態で、BOFが発生していた問題を修正した。
FIXME: ただし、SCPによるファイル送信途中に、例外で落ちるので、まだ不完全。

Modified Paths:
--------------
    trunk/ttssh2/ttxssh/buffer.c
    trunk/ttssh2/ttxssh/buffer.h
    trunk/ttssh2/ttxssh/ssh.c


-------------- next part --------------
Modified: trunk/ttssh2/ttxssh/buffer.c
===================================================================
--- trunk/ttssh2/ttxssh/buffer.c	2011-06-08 12:17:07 UTC (rev 4491)
+++ trunk/ttssh2/ttxssh/buffer.c	2011-06-09 15:25:43 UTC (rev 4492)
@@ -51,6 +51,37 @@
 	}
 }
 
+// ƒoƒbƒtƒ@‚̗̈æŠg’£‚Ì‚Ý‚ðs‚¤B
+void buffer_append_space(buffer_t * buf, int size)
+{
+	int n;
+	int ret = -1;
+	int newlen;
+
+	n = buf->offset + size;
+	if (n < buf->maxlen) {
+		// 
+	} else {
+		// ƒoƒbƒtƒ@‚ª‘«‚è‚È‚¢‚Ì‚Å•â[‚·‚éB(2005.7.2 yutaka)
+		newlen = buf->maxlen + size + 32*1024;
+		if (newlen > 0xa00000) { // 1MB over is not supported
+			goto panic;
+		}
+		buf->buf = realloc(buf->buf, newlen);
+		if (buf->buf == NULL)
+			goto panic;
+		buf->maxlen = newlen;
+	}
+
+	return;
+
+panic:
+	{
+	char *p = NULL;
+	*p = 0; // application fault
+	}
+}
+
 int buffer_append(buffer_t * buf, char *ptr, int size)
 {
 	int n;

Modified: trunk/ttssh2/ttxssh/buffer.h
===================================================================
--- trunk/ttssh2/ttxssh/buffer.h	2011-06-08 12:17:07 UTC (rev 4491)
+++ trunk/ttssh2/ttxssh/buffer.h	2011-06-09 15:25:43 UTC (rev 4492)
@@ -15,6 +15,7 @@
 void buffer_clear(buffer_t *buf);
 buffer_t *buffer_init(void);
 void buffer_free(buffer_t *buf);
+void buffer_append_space(buffer_t * buf, int size);
 int buffer_append(buffer_t *buf, char *ptr, int size);
 int buffer_append_length(buffer_t *msg, char *ptr, int size);
 void buffer_put_raw(buffer_t *msg, char *ptr, int size);

Modified: trunk/ttssh2/ttxssh/ssh.c
===================================================================
--- trunk/ttssh2/ttxssh/ssh.c	2011-06-08 12:17:07 UTC (rev 4491)
+++ trunk/ttssh2/ttxssh/ssh.c	2011-06-09 15:25:43 UTC (rev 4492)
@@ -1097,6 +1097,10 @@
 		set_uint32(data, encryption_size - 4);
 		data[4] = (unsigned char) padding;
 		data_length = encryption_size + CRYPT_get_sender_MAC_size(pvar);
+		if (msg) {
+			// ƒpƒPƒbƒgˆ³k‚̏ꍇAƒoƒbƒtƒ@‚ðŠg’£‚·‚éB(2011.6.10 yutaka)
+			buffer_append_space(msg, padding + EVP_MAX_MD_SIZE);
+		}
 #endif
 		//if (pvar->ssh_state.outbuflen <= 7 + data_length) *(int *)0 = 0;
 		CRYPT_set_random_data(pvar, data + 5 + len, padding);



Ttssh2-commit メーリングリストの案内
Back to archive index