From: Christopher Faulet Date: Mon, 8 Jun 2020 15:09:17 +0000 (+0200) Subject: BUG/MAJOR: http-htx: Don't forget to copy error messages from defaults sections X-Git-Tag: v2.1.7~1 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=661c88907739d9dac49d51e4d54bf388f5dbfdba;p=haproxy-2.1.git BUG/MAJOR: http-htx: Don't forget to copy error messages from defaults sections A bug was introduced in the commit c9dbbbdfc ("BUG/MEDIUM: http-htx: Duplicate error messages as raw data instead of string"). No copy is performed in this patch. The memory is allocated but the copy is not perfomed. It is stupid and it affects all configuration with errofiles defined in a defaults section. This patch should fix the issue #669. This bug is specific to the 2.1. Other versions are not affected. Thus, there is no upstream commit ID for this patch. And it should not be backported. --- diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c index 8ec49fb..fa5723e 100644 --- a/src/cfgparse-listen.c +++ b/src/cfgparse-listen.c @@ -267,15 +267,15 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) const struct buffer *src = &defproxy.errmsg[rc]; if (b_orig(src)) { - dst->head = src->head; - dst->data = src->data; - dst->size = src->size; + dst->head = 0; + dst->data = 0; + dst->size = 0; dst->area = malloc(src->size); - if (!dst->area) { - dst->head = 0; - dst->data = 0; - dst->size = 0; - continue; + if (dst->area) { + dst->head = src->head; + dst->data = src->data; + dst->size = src->size; + memcpy(dst->area, src->area, dst->data); } } }