comparison packet.c @ 1511:5916af64acd4 fuzz

merge from main
author Matt Johnston <matt@ucc.asn.au>
date Sat, 17 Feb 2018 19:29:51 +0800
parents 27e65d3aed5f fdae6fae00af
children 2f64cb3d3007
comparison
equal deleted inserted replaced
1457:32f990cc96b1 1511:5916af64acd4
48 * We might allocate 5 unnecessary bytes here if it's an 48 * We might allocate 5 unnecessary bytes here if it's an
49 * exact multiple. */ 49 * exact multiple. */
50 #define ZLIB_COMPRESS_EXPANSION (((RECV_MAX_PAYLOAD_LEN/16384)+1)*5 + 6) 50 #define ZLIB_COMPRESS_EXPANSION (((RECV_MAX_PAYLOAD_LEN/16384)+1)*5 + 6)
51 #define ZLIB_DECOMPRESS_INCR 1024 51 #define ZLIB_DECOMPRESS_INCR 1024
52 #ifndef DISABLE_ZLIB 52 #ifndef DISABLE_ZLIB
53 static buffer* buf_decompress(buffer* buf, unsigned int len); 53 static buffer* buf_decompress(const buffer* buf, unsigned int len);
54 static void buf_compress(buffer * dest, buffer * src, unsigned int len); 54 static void buf_compress(buffer * dest, buffer * src, unsigned int len);
55 #endif 55 #endif
56 56
57 /* non-blocking function writing out a current encrypted packet */ 57 /* non-blocking function writing out a current encrypted packet */
58 void write_packet() { 58 void write_packet() {
343 #endif 343 #endif
344 { 344 {
345 ses.payload = ses.readbuf; 345 ses.payload = ses.readbuf;
346 ses.payload_beginning = ses.payload->pos; 346 ses.payload_beginning = ses.payload->pos;
347 buf_setlen(ses.payload, ses.payload->pos + len); 347 buf_setlen(ses.payload, ses.payload->pos + len);
348 /* copy payload */
349 //ses.payload = buf_new(len);
350 //memcpy(ses.payload->data, buf_getptr(ses.readbuf, len), len);
351 //buf_incrlen(ses.payload, len);
352 } 348 }
353 ses.readbuf = NULL; 349 ses.readbuf = NULL;
354 350
355 ses.recvseq++; 351 ses.recvseq++;
356 352
391 } 387 }
392 } 388 }
393 389
394 #ifndef DISABLE_ZLIB 390 #ifndef DISABLE_ZLIB
395 /* returns a pointer to a newly created buffer */ 391 /* returns a pointer to a newly created buffer */
396 static buffer* buf_decompress(buffer* buf, unsigned int len) { 392 static buffer* buf_decompress(const buffer* buf, unsigned int len) {
397 393
398 int result; 394 int result;
399 buffer * ret; 395 buffer * ret;
400 z_streamp zstream; 396 z_streamp zstream;
401 397