]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: compression: fix the output type of the compressor name
authorWilly Tarreau <w@1wt.eu>
Tue, 11 Mar 2014 15:23:05 +0000 (16:23 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 11 Mar 2014 15:23:05 +0000 (16:23 +0100)
smp_fetch_res_comp_algo() returns the name of the compression algorithm
in use. The output type is set to SMP_T_STR instead of SMP_T_CSTR, which
causes any transformation to be operated without a cast. Fortunately,
the current converters do not overwrite a zero-sized area, so the result
is an empty string. Fix this to have SMP_T_CSTR instead so that the cast
is always performed using a copy before any transformation is done.

src/compression.c

index 27ba4b4b0aa32e0d75abf8cd4d04f3f1ad2ab42d..f42f77101fcb35146086028ee4fb7cc6ab0e64ca 100644 (file)
@@ -628,7 +628,7 @@ smp_fetch_res_comp_algo(struct proxy *px, struct session *l4, void *l7, unsigned
        if (!l4->comp_algo)
                return 0;
 
-       smp->type = SMP_T_STR;
+       smp->type = SMP_T_CSTR;
        smp->data.str.str = l4->comp_algo->name;
        smp->data.str.len = l4->comp_algo->name_len;
        return 1;