On Wed, Sep 16, 2026 at 07:38:10PM +0200, Jonas Rebmann wrote: > All of the available sequences expand to exactly one byte, the size > check in the loop condition is sufficient for the case of an escaped > character too. > > Otherwise, an escape sequence that should be unescaped to the last > character before terminating with null in the destination buffer will be > output as backslash instead of the escaped character. > > The only exception is when encountering a backslash that turns out to > not start a valid escape sequence and both the backslash and the > character following are handled in one iteration. Move the check there. > > Add a kunit regression-test that unescapes a character to right in front > of the null terminator of the destination buffer.
Without examples (and the respective hexdumps) it's hard to get. I re-read the code and see no issues there. The size > 1 check is for the \\ and \0 at the end of the destination buffer. So, if the sequence is not recognized it means that it's separate \\ in the stream and has to be copied as is. -- With Best Regards, Andy Shevchenko

