Josh Cepek wrote:
Assuming I have read the source correctly, it seems to me that the packet could be dropped (probably with an associated error to the log) rather than using an ASSERT() call. This way malformed data from internal clients behind a VPN peer won't bring down the VPN.
I've attached a patch that does this. It compiles & runs fine for me and the logging appears to work as expected (I tested this by reversing the conditional test since I don't have the problem originally reported.)
I'm not completely sure on the correctness of the process to empty the buffer to ignore the packet, but from the other code in this function I believe what I've added will simply cause the bad packet to be ignored. Feel free to change if necessary.
-- Josh
--- /home/josh/src/openvpn/openvpn-2.1_rc7/lzo.c 2008-01-23 21:08:41.000000000 +0000 +++ /home/josh/temp/lzo.c.new 2008-07-19 08:32:50.000000000 +0000 @@ -162,7 +162,12 @@ { 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 failed: buffer exceeds allowable payload length"); + buf->len = 0; + return; + } err = LZO_COMPRESS (BPTR (buf), BLEN (buf), BPTR (&work), &zlen, lzowork->wmem); if (err != LZO_E_OK)
signature.asc
Description: OpenPGP digital signature