fix incorrect str length comparision in unescape_string

Sat, 25 Jan 2025 16:27:32 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 25 Jan 2025 16:27:32 +0100
changeset 1150
7b0bd5e76b5d
parent 1149
df5665de7344
child 1151
60113356a7de

fix incorrect str length comparision in unescape_string

src/json.c file | annotate | diff | comparison | revisions
--- a/src/json.c	Sat Jan 25 16:13:28 2025 +0100
+++ b/src/json.c	Sat Jan 25 16:27:32 2025 +0100
@@ -399,7 +399,7 @@
             } else if (c == 'b') {
                 c = '\b';
             } else if (c == 'u') {
-                if (i+4 < str.length) {
+                if (i+4 < str.length - 1) {
                     cxstring codepoint_str = { str.ptr + i + 1, 4};
                     uint32_t codepoint;
                     if(!cx_strtou32_lc_(codepoint_str, &codepoint, 16, "")) {

mercurial