Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/xml.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,11 @@ lyxml_skip_until_end_or_after_otag(struct lyxml_ctx *xmlctx)
++xmlctx->in->current;

LY_CHECK_RET(lyxml_check_read(xmlctx, 1));
if (xmlctx->in->current[0] == '!') {
if (xmlctx->in->current[0] == '\0') {
/* EOF right after '<' */
LOGVAL(ctx, NULL, LY_VCODE_EOF);
return LY_EVALID;
} else if (xmlctx->in->current[0] == '!') {
++xmlctx->in->current;

/* sections to ignore */
Expand Down
4 changes: 4 additions & 0 deletions tests/utests/data/test_parser_xml.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,10 @@ test_container(void **state)
cont = (struct lyd_node_inner *)tree;
assert_false(cont->flags & LYD_DEFAULT);
lyd_free_all(tree);

/* input ending right after the '<' of the next tag */
PARSER_CHECK_ERROR("<cp xmlns=\"urn:tests:a\"><", 0, LYD_VALIDATE_PRESENT, tree, LY_EVALID,
"Unexpected end-of-input.", NULL, 1);
}

static void
Expand Down