From b8bd3b4768d465bc51ab999e9188e25a7e7ad68e Mon Sep 17 00:00:00 2001 From: bz Date: Sat, 5 Dec 2009 19:12:35 +0000 Subject: [PATCH] MFC r199906: In case the compression result is the same size as the orignal version, the compression was useless as well. Make sure to not update the data and return, else we would waste resources when decompressing. This also avoids the copyback() changing data other consumers like xform_ipcomp.c would have ignored because of no win and sent out without noting that compression was used, resulting in invalid packets at the receiver. git-svn-id: svn://svn.freebsd.org/base/stable/8@200147 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/opencrypto/cryptosoft.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index 2769be667..97b73a214 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -552,7 +552,7 @@ swcr_compdec(struct cryptodesc *crd, struct swcr_data *sw, sw->sw_size = result; /* Check the compressed size when doing compression */ if (crd->crd_flags & CRD_F_COMP) { - if (result > crd->crd_len) { + if (result >= crd->crd_len) { /* Compression was useless, we lost time */ free(out, M_CRYPTO_DATA); return 0; -- 2.45.0