mirror of
https://github.com/haproxy/haproxy.git
synced 2026-07-15 03:56:56 -04:00
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.
This commit is contained in:
parent
1e1e780b79
commit
ff95f204ec
1 changed files with 4 additions and 0 deletions
|
|
@ -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++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue