Skip to content

Commit 79596bc

Browse files
authored
fix: check string length before checking unicode sequence
1 parent 8dcbe38 commit 79596bc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/serializer.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ static void jx_EncodeJsonStream (PSTREAM p , PUCHAR in)
5151
}
5252
}
5353
else if (c == pJw->backSlash) {
54-
if (in[1] != 'u' // Dont double escape unicode escape sequence
54+
// Dont double escape unicode escape sequence
55+
if (strlen(in) < 6 || in[1] != 'u'
5556
|| !isxdigit(in[2]) || !isxdigit(in[3])
5657
|| !isxdigit(in[4]) || !isxdigit(in[5])) {
5758
stream_putc(p,pJw->backSlash);

0 commit comments

Comments
 (0)