From: John Wolfe Date: Tue, 12 Jul 2022 16:56:01 +0000 (-0700) Subject: Fix a bug in CodeSet_JsonEscape. X-Git-Tag: stable-12.1.0~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ddfb569588d8b1a9cd31cb3bb5d33c58c72f7fbc;p=thirdparty%2Fopen-vm-tools.git Fix a bug in CodeSet_JsonEscape. Fix a bug introduced in an earlier change in which CodeSet_JsonEscape erroneously tests the first character in the buffer when checking whether to escape the character currently being processed. --- diff --git a/open-vm-tools/lib/misc/jsonUTF8.c b/open-vm-tools/lib/misc/jsonUTF8.c index 722897147..88450e3e9 100644 --- a/open-vm-tools/lib/misc/jsonUTF8.c +++ b/open-vm-tools/lib/misc/jsonUTF8.c @@ -96,7 +96,7 @@ CodeSet_JsonEscape(const char *utf8) // IN: break; } - if (len > 1 || (*utf8 > 0x001F && *utf8 != '"' && *utf8 != '\\')) { + if (len > 1 || (*p > 0x001F && *p != '"' && *p != '\\')) { DynBuf_SafeAppend(&b, p, len); } else { DynBuf_SafeAppend(&b, "\\", 1);