Skip to content

Commit

Permalink
fix: check string length before checking unicode sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
janfh authored Dec 4, 2024
1 parent 8dcbe38 commit 79596bc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/serializer.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ static void jx_EncodeJsonStream (PSTREAM p , PUCHAR in)
}
}
else if (c == pJw->backSlash) {
if (in[1] != 'u' // Dont double escape unicode escape sequence
// Dont double escape unicode escape sequence
if (strlen(in) < 6 || in[1] != 'u'
|| !isxdigit(in[2]) || !isxdigit(in[3])
|| !isxdigit(in[4]) || !isxdigit(in[5])) {
stream_putc(p,pJw->backSlash);
Expand Down

0 comments on commit 79596bc

Please sign in to comment.