aboutsummaryrefslogtreecommitdiff
path: root/lzo.c
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2008-08-11 03:37:40 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2008-08-11 03:37:40 +0000
commite1cf60c56fd3759eb93d130e4d99ecefd831c10d (patch)
tree47ce754d85217de84ce01d725bc6378aa6630f3a /lzo.c
parentWorkaround bug in OpenSSL 0.9.6b ASN1_STRING_to_UTF8, which (diff)
downloadopenvpn-e1cf60c56fd3759eb93d130e4d99ecefd831c10d.tar.xz
LZO compression buffer overflow errors will now invalidate
the packet rather than trigger a fatal assertion. git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@3221 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to 'lzo.c')
-rw-r--r--lzo.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/lzo.c b/lzo.c
index cdb685a..58bf9f2 100644
--- a/lzo.c
+++ b/lzo.c
@@ -156,7 +156,13 @@ lzo_compress (struct buffer *buf, struct buffer work,
{
ASSERT (buf_init (&work, FRAME_HEADROOM (frame)));
ASSERT (buf_safe (&work, LZO_EXTRA_BUFFER (PAYLOAD_SIZE (frame))));
- ASSERT (buf->len <= PAYLOAD_SIZE (frame));
+
+ if (!(buf->len <= PAYLOAD_SIZE (frame)))
+ {
+ dmsg (D_COMP_ERRORS, "LZO compression buffer overflow");
+ buf->len = 0;
+ return;
+ }
err = LZO_COMPRESS (BPTR (buf), BLEN (buf), BPTR (&work), &zlen, lzowork->wmem);
if (err != LZO_E_OK)