path BUGFIX check mandatory .. in relative leafref
diff --git a/src/path.c b/src/path.c
index 9c1fb16..0552e66 100644
--- a/src/path.c
+++ b/src/path.c
@@ -246,10 +246,17 @@
if (begin == LY_PATH_BEGIN_EITHER) {
/* is the path relative? */
if (lyxp_next_token(NULL, exp, &tok_idx, LYXP_TOKEN_OPER_PATH)) {
- /* '..' */
- while ((lref == LY_PATH_LREF_TRUE) && !lyxp_next_token(NULL, exp, &tok_idx, LYXP_TOKEN_DDOT)) {
- /* '/' */
- LY_CHECK_ERR_GOTO(lyxp_next_token(ctx, exp, &tok_idx, LYXP_TOKEN_OPER_PATH), ret = LY_EVALID, error);
+ /* relative path check specific to leafref */
+ if (lref == LY_PATH_LREF_TRUE) {
+ /* mandatory '..' */
+ LY_CHECK_ERR_GOTO(lyxp_next_token(ctx, exp, &tok_idx, LYXP_TOKEN_DDOT), ret = LY_EVALID, error);
+
+ do {
+ /* '/' */
+ LY_CHECK_ERR_GOTO(lyxp_next_token(ctx, exp, &tok_idx, LYXP_TOKEN_OPER_PATH), ret = LY_EVALID, error);
+
+ /* optional '..' */
+ } while (!lyxp_next_token(NULL, exp, &tok_idx, LYXP_TOKEN_DDOT));
}
}
} else {