From: Frederic Lecaille Date: Wed, 8 Jul 2026 06:24:19 +0000 (+0200) Subject: BUG/MINOR: hbuf: treat unexpected escape sequences as literals X-Git-Tag: v3.5-dev2~26 X-Git-Url: http://git.kaiwu.me/postgresql/log/contrib/static/gitweb.js?a=commitdiff_plain;h=ff95f204ec9f938526eb383604f7e62d05b85de1;p=haproxy.git BUG/MINOR: hbuf: treat unexpected escape sequences as literals When encountering an unexpected escape sequence, treat it as a literal character instead of skipping it. This is a deliberate choice for two reasons: - to avoid a desynchronization between the h->data counter and the buffer content, which would otherwise leave uninitialized memory ("garbage") in the destination buffer; - to ensure that an invalid configuration string triggers a parsing error immediately (fail-fast), rather than resulting in a silently malformed configuration. Thank to @dirkmueller for having reported this issue. No need to backport. huf arrived with this current version. --- diff --git a/src/hbuf.c b/src/hbuf.c index 6c16580b1..e15bd85d5 100644 --- a/src/hbuf.c +++ b/src/hbuf.c @@ -55,6 +55,10 @@ void hbuf_str_append(struct hbuf *h, const char *line) } else if (*p == 't') *to++ = '\t'; + else { + /* unexpected escape sequence, treat as literal */ + *to++ = *p; + } p++; h->data++; }