parser yin BUGFIX fix checking first character in identitifier
diff --git a/src/parser_yin.c b/src/parser_yin.c
index fde4e05..59783f2 100644
--- a/src/parser_yin.c
+++ b/src/parser_yin.c
@@ -420,8 +420,6 @@
while (already_read < ctx->xmlctx->value_len) {
LY_CHECK_ERR_RET(ly_getutf8((const char **)&val, &c, &utf8_char_len),
LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INCHAR, (val)[-utf8_char_len]), LY_EVALID);
- already_read += utf8_char_len;
- LY_CHECK_ERR_RET(already_read > ctx->xmlctx->value_len, LOGINT(ctx->xmlctx->ctx), LY_EINT);
switch (val_type) {
case Y_IDENTIF_ARG:
@@ -435,6 +433,9 @@
LY_CHECK_RET(lysp_check_stringchar((struct lys_parser_ctx *)ctx, c));
break;
}
+
+ already_read += utf8_char_len;
+ LY_CHECK_ERR_RET(already_read > ctx->xmlctx->value_len, LOGINT(ctx->xmlctx->ctx), LY_EINT);
}
return LY_SUCCESS;
diff --git a/tests/utests/schema/test_parser_yin.c b/tests/utests/schema/test_parser_yin.c
index f4ac977..7c726ff 100644
--- a/tests/utests/schema/test_parser_yin.c
+++ b/tests/utests/schema/test_parser_yin.c
@@ -657,7 +657,7 @@
YCTX->xmlctx->value = "#invalid";
YCTX->xmlctx->value_len = 8;
assert_int_equal(yin_validate_value(YCTX, Y_IDENTIF_ARG), LY_EVALID);
- CHECK_LOG_CTX("Invalid identifier character '#' (0x0023).", "Line number 1.");
+ CHECK_LOG_CTX("Invalid identifier first character '#' (0x0023).", "Line number 1.");
YCTX->xmlctx->value = "";
YCTX->xmlctx->value_len = 0;