]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
LZO compression buffer overflow errors will now invalidate
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>
Mon, 11 Aug 2008 03:37:40 +0000 (03:37 +0000)
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>
Mon, 11 Aug 2008 03:37:40 +0000 (03:37 +0000)
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

lzo.c

diff --git a/lzo.c b/lzo.c
index cdb685a7878dc3303b360ee39e2b6ce837d67a85..58bf9f2716cb6a45bbc5b86a2587e1dc4069f282 100644 (file)
--- 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)