Browse Source

fixed lzo datatype (#447)

Co-authored-by: Logan007 <you@example.com>
pull/454/head
Logan oos Even 4 years ago
committed by GitHub
parent
commit
1c45c7101a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      src/edge_utils.c

6
src/edge_utils.c

@ -1059,20 +1059,20 @@ static int handle_PACKET(n2n_edge_t * eee,
/* decompress if necessary */ /* decompress if necessary */
uint8_t * deflation_buffer = 0; uint8_t * deflation_buffer = 0;
int32_t deflated_len; lzo_uint deflated_len;
switch (rx_compression_id) { switch (rx_compression_id) {
case N2N_COMPRESSION_ID_NONE: case N2N_COMPRESSION_ID_NONE:
break; // continue afterwards break; // continue afterwards
case N2N_COMPRESSION_ID_LZO: case N2N_COMPRESSION_ID_LZO:
deflation_buffer = malloc (N2N_PKT_BUF_SIZE); deflation_buffer = malloc (N2N_PKT_BUF_SIZE);
lzo1x_decompress (eth_payload, eth_size, deflation_buffer, (lzo_uint*)&deflated_len, NULL); lzo1x_decompress (eth_payload, eth_size, deflation_buffer, &deflated_len, NULL);
break; break;
#ifdef N2N_HAVE_ZSTD #ifdef N2N_HAVE_ZSTD
case N2N_COMPRESSION_ID_ZSTD: case N2N_COMPRESSION_ID_ZSTD:
deflated_len = N2N_PKT_BUF_SIZE; deflated_len = N2N_PKT_BUF_SIZE;
deflation_buffer = malloc (deflated_len); deflation_buffer = malloc (deflated_len);
deflated_len = (int32_t)ZSTD_decompress (deflation_buffer, deflated_len, eth_payload, eth_size); deflated_len = ZSTD_decompress (deflation_buffer, deflated_len, eth_payload, eth_size);
if(ZSTD_isError(deflated_len)) { if(ZSTD_isError(deflated_len)) {
traceEvent (TRACE_ERROR, "payload decompression failed with zstd error '%s'.", traceEvent (TRACE_ERROR, "payload decompression failed with zstd error '%s'.",
ZSTD_getErrorName(deflated_len)); ZSTD_getErrorName(deflated_len));

Loading…
Cancel
Save