Permalink
Browse files

Prepare compression functions for fuzzing

  • Loading branch information...
guidovranken committed Jun 26, 2017
1 parent 354a3a3 commit 7fd8f5fcdfa6310787809a3828e887d48a16ae6e
Showing with 20 additions and 5 deletions.
  1. +4 −1 src/openvpn/comp-lz4.c
  2. +4 −1 src/openvpn/comp.c
  3. +8 −2 src/openvpn/compstub.c
  4. +4 −1 src/openvpn/lzo.c
View
@@ -139,7 +139,10 @@ lz4_compress(struct buffer *buf, struct buffer work,
{
uint8_t *head = BPTR(buf);
uint8_t *tail = BEND(buf);
ASSERT(buf_safe(buf, 1));
if ( !(buf_safe(buf, 1)) )
{
return;
}
++buf->len;
/* move head byte of payload to tail */
View
@@ -98,7 +98,10 @@ compv2_escape_data_ifneeded(struct buffer *buf)
}
/* Header is 0x50 */
ASSERT(buf_prepend(buf, 2));
if ( !(buf_prepend(buf, 2)) )
{
return;
}
head = BPTR(buf);
head[0] = COMP_ALGV2_INDICATOR_BYTE;
View
@@ -60,7 +60,10 @@ stub_compress(struct buffer *buf, struct buffer work,
{
uint8_t *head = BPTR(buf);
uint8_t *tail = BEND(buf);
ASSERT(buf_safe(buf, 1));
if ( !(buf_safe(buf, 1)) )
{
return;
}
++buf->len;
/* move head byte of payload to tail */
@@ -70,7 +73,10 @@ stub_compress(struct buffer *buf, struct buffer work,
else
{
uint8_t *header = buf_prepend(buf, 1);
*header = NO_COMPRESS_BYTE;
if (header)
{
*header = NO_COMPRESS_BYTE;
}
}
}
View
@@ -202,7 +202,10 @@ lzo_compress(struct buffer *buf, struct buffer work,
else
{
uint8_t *header = buf_prepend(buf, 1);
*header = NO_COMPRESS_BYTE;
if (header)
{
*header = NO_COMPRESS_BYTE;
}
}
}

0 comments on commit 7fd8f5f

Please sign in to comment.