]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Fix a bug in CodeSet_JsonEscape.
authorJohn Wolfe <jwolfe@vmware.com>
Tue, 12 Jul 2022 16:56:01 +0000 (09:56 -0700)
committerJohn Wolfe <jwolfe@vmware.com>
Tue, 12 Jul 2022 16:56:01 +0000 (09:56 -0700)
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.

open-vm-tools/lib/misc/jsonUTF8.c

index 72289714749f5bf112c667773b2865069c226cc3..88450e3e92489a98fc2b49b41e5524ffdec6f3fb 100644 (file)
@@ -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);