diff --git a/src/common/Utils.c b/src/common/Utils.c index 96a577b..7dd0262 100644 --- a/src/common/Utils.c +++ b/src/common/Utils.c @@ -31,6 +31,7 @@ size_t RabbitizerUtils_escapeString(char *dst, size_t dstSize, const char *src, size_t dstpos = 0; for (; srcPos < srcSize && dstpos < dstSize; srcPos++, src++) { + // The cases of this switch are sorted by ASCII order switch (*src) { case '\a': RABUTILS_BUFFER_WRITE_CHAR(dst, dstpos, '\\'); @@ -62,6 +63,11 @@ size_t RabbitizerUtils_escapeString(char *dst, size_t dstSize, const char *src, RABUTILS_BUFFER_WRITE_CHAR(dst, dstpos, '"'); break; + case '\\': + RABUTILS_BUFFER_WRITE_CHAR(dst, dstpos, '\\'); + RABUTILS_BUFFER_WRITE_CHAR(dst, dstpos, '\\'); + break; + default: RABUTILS_BUFFER_WRITE_CHAR(dst, dstpos, *src); break;