diff options
author | Matt Johnston <matt@ucc.asn.au> | 2015-03-01 00:57:21 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2015-03-01 00:57:21 +0800 |
commit | 579463933b6328b8d54ea246c0d0c7745fb8542a (patch) | |
tree | dcd80d452566b8dea94004e3747c7a3416a50d5c /common-kex.c | |
parent | 989c5c14361671ceaf3e78313a56d4260bcb49f9 (diff) |
A bit of a bodge to avoid memcpy if zlib is disabled
--HG--
branch : nocircbuffer
Diffstat (limited to 'common-kex.c')
-rw-r--r-- | common-kex.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/common-kex.c b/common-kex.c index f355560..0e477da 100644 --- a/common-kex.c +++ b/common-kex.c @@ -534,8 +534,10 @@ void recv_msg_kexinit() { buf_putstring(ses.kexhashbuf, ses.transkexinit->data, ses.transkexinit->len); /* I_S, the payload of the server's SSH_MSG_KEXINIT */ - buf_setpos(ses.payload, 0); - buf_putstring(ses.kexhashbuf, ses.payload->data, ses.payload->len); + buf_setpos(ses.payload, ses.payload_beginning); + buf_putstring(ses.kexhashbuf, + buf_getptr(ses.payload, ses.payload->len-ses.payload->pos), + ses.payload->len-ses.payload->pos); ses.requirenext = SSH_MSG_KEXDH_REPLY; } else { /* SERVER */ @@ -549,8 +551,10 @@ void recv_msg_kexinit() { (unsigned char*)LOCAL_IDENT, local_ident_len); /* I_C, the payload of the client's SSH_MSG_KEXINIT */ - buf_setpos(ses.payload, 0); - buf_putstring(ses.kexhashbuf, ses.payload->data, ses.payload->len); + buf_setpos(ses.payload, ses.payload_beginning); + buf_putstring(ses.kexhashbuf, + buf_getptr(ses.payload, ses.payload->len-ses.payload->pos), + ses.payload->len-ses.payload->pos); /* I_S, the payload of the server's SSH_MSG_KEXINIT */ buf_putstring(ses.kexhashbuf, |