Mercurial > dropbear
comparison packet.c @ 1055:4d7b4c5526c5 nocircbuffer
A bit of a bodge to avoid memcpy if zlib is disabled
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sun, 01 Mar 2015 00:57:21 +0800 |
parents | 0da8ba489c23 |
children | 16584026a1f0 |
comparison
equal
deleted
inserted
replaced
1054:c71df09bc610 | 1055:4d7b4c5526c5 |
---|---|
312 | 312 |
313 #ifndef DISABLE_ZLIB | 313 #ifndef DISABLE_ZLIB |
314 if (is_compress_recv()) { | 314 if (is_compress_recv()) { |
315 /* decompress */ | 315 /* decompress */ |
316 ses.payload = buf_decompress(ses.readbuf, len); | 316 ses.payload = buf_decompress(ses.readbuf, len); |
317 buf_setpos(ses.payload, 0); | |
318 ses.payload_beginning = 0; | |
319 buf_free(ses.readbuf); | |
317 } else | 320 } else |
318 #endif | 321 #endif |
319 { | 322 { |
323 ses.payload = ses.readbuf; | |
324 ses.payload_beginning = ses.payload->pos; | |
325 buf_setlen(ses.payload, ses.payload->pos + len); | |
320 /* copy payload */ | 326 /* copy payload */ |
321 ses.payload = buf_new(len); | 327 //ses.payload = buf_new(len); |
322 memcpy(ses.payload->data, buf_getptr(ses.readbuf, len), len); | 328 //memcpy(ses.payload->data, buf_getptr(ses.readbuf, len), len); |
323 buf_incrlen(ses.payload, len); | 329 //buf_incrlen(ses.payload, len); |
324 } | 330 } |
325 | |
326 buf_free(ses.readbuf); | |
327 ses.readbuf = NULL; | 331 ses.readbuf = NULL; |
328 buf_setpos(ses.payload, 0); | |
329 | 332 |
330 ses.recvseq++; | 333 ses.recvseq++; |
331 | 334 |
332 TRACE2(("leave decrypt_packet")) | 335 TRACE2(("leave decrypt_packet")) |
333 } | 336 } |