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.
}
else if (*p == 't')
*to++ = '\t';
+ else {
+ /* unexpected escape sequence, treat as literal */
+ *to++ = *p;
+ }
p++;
h->data++;
}