Fix assert when comp is called with unknown algorithm, always call comp init method
PATCH 1/1 Fix assert when comp is called with unknown algorithm, always call comp init method
--- src/openvpn/comp.c | 6 +++--- src/openvpn/options.c | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-)
src/openvpn/comp.c +3 -3
@@ -48,7 +48,6 @@ comp_init(const struct compress_options *opt) ALLOC_OBJ_CLEAR (compctx, struct compress_context); compctx->flags = opt->flags; compctx->alg = comp_stub_alg; - (*compctx->alg.compress_init)(compctx);break ;case COMP_ALGV2_UNCOMPRESSED : ALLOC_OBJ_CLEAR (compctx, struct compress_context);
@@ -60,7 +59,6 @@ comp_init(const struct compress_options *opt) ALLOC_OBJ_CLEAR (compctx, struct compress_context); compctx->flags = opt->flags; compctx->alg = lzo_alg; - (*compctx->alg.compress_init)(compctx);break ;#endif #ifdef ENABLE_LZ4
@@ -68,7 +66,6 @@ comp_init(const struct compress_options *opt) ALLOC_OBJ_CLEAR (compctx, struct compress_context); compctx->flags = opt->flags; compctx->alg = lz4_alg; - (*compctx->alg.compress_init)(compctx);break ;case COMP_ALGV2_LZ4 : ALLOC_OBJ_CLEAR (compctx, struct compress_context);
@@ -77,6 +74,9 @@ comp_init(const struct compress_options *opt)break ;#endif } +if (compctx) + (*compctx->alg.compress_init)(compctx); +return compctx; }
src/openvpn/options.c +2 -1
@@ -6318,7 +6318,6 @@ add_option (struct options *options,VERIFY_PERMISSION (OPT_P_COMP );if (p[1 ]) { - options->comp.flags =0 ;if (streq (p[1 ],"stub" )) { options->comp.alg =COMP_ALG_STUB ;
@@ -6333,6 +6332,7 @@ add_option (struct options *options, else if (streq (p[1], "lzo")) { options->comp.alg =COMP_ALG_LZO ; + options->comp.flags =0 ; }#endif #if defined(ENABLE_LZ4 )
@@ -6344,6 +6344,7 @@ add_option (struct options *options, else if (streq (p[1], "lz4-v2")) { options->comp.alg =COMP_ALGV2_LZ4 ; + options->comp.flags =0 ; }#endif else
Signature · 1 line
2.5.4 (Apple Git-61)
Your patch has been applied to the master branch.
commit 67b3de98e3b5327a9330b499d6cff179624b8ec2
Author: Arne Schwabe Date: Tue Jan 5 15:56:01 2016 +0100
Fix assert when comp is called with unknown algorithm, always call comp init method
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: http://article.gmane.org/gmane.network.openvpn.devel/10939
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering