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.
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);
}
}
}