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 @@ } } +// obt@ÌÌæ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 { + // obt@ª«èÈ¢ÌÅâ[·é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) { + // pPbg³kÌêAobt@ð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);