summaryrefslogtreecommitdiff
path: root/plparse
diff options
context:
space:
mode:
authorcrvi <crvisqr@gmail.com>2021-04-07 04:00:30 +0530
committercrvi <crvisqr@gmail.com>2021-04-24 00:01:20 +0530
commit0b89b79c50d9a0a22f23d1ba40a73f9f3cd54da2 (patch)
tree9c8093d066b4e741aa8dd126aebe98473fa8f791 /plparse
parentd15ff715418d744acd038c1f3d8df2d65c997182 (diff)
downloadtotem-pl-parser-0b89b79c50d9a0a22f23d1ba40a73f9f3cd54da2.tar.gz
core: fix garbage in CDATA values for shorter texts
This change properly null terminates the CDATA values. For shorter CDATA values, this fix is mandatory to override the token buffer text which contains the previous token value of '<![CDATA['. CDATA value is overwritten on top of this CDATA marker causing garbage data. For longer CDATA values, this wasn't an issue, as the token buffer ( 64K ) is already filled with NULL chars, causing this issue to not show up. Closes: #30
Diffstat (limited to 'plparse')
-rw-r--r--plparse/xmllexer.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/plparse/xmllexer.c b/plparse/xmllexer.c
index 818e7f8..fc448ea 100644
--- a/plparse/xmllexer.c
+++ b/plparse/xmllexer.c
@@ -541,6 +541,7 @@ int lexer_get_token_d_r(struct lexer * lexer, char ** _tok, int * _tok_size, int
if (strncmp(lexer->lexbuf + lexer->lexbuf_pos, "]]>", 3) == 0) {
lexer->lexbuf_pos += 3;
lexer->lex_mode = DATA;
+ tok[tok_pos] = '\0';
return T_CDATA_STOP;
} else {
tok[tok_pos] = c;