parser yang BUGFIX comments not allowed in unquoted strings
diff --git a/src/parser_yang.c b/src/parser_yang.c
index 9fef72a..57b5f9b 100644
--- a/src/parser_yang.c
+++ b/src/parser_yang.c
@@ -596,6 +596,7 @@
     size_t buf_len = 0;
     uint8_t prefix = 0;
     ly_bool str_end = 0;
+    int comment;
 
     /* word buffer - dynamically allocated */
     *word_b = NULL;
@@ -627,18 +628,30 @@
             str_end = 1;
             break;
         case '/':
+            comment = 0;
             if (ctx->in->current[1] == '/') {
                 /* one-line comment */
-                MOVE_INPUT(ctx, 2);
-                LY_CHECK_GOTO(ret = skip_comment(ctx, 1), error);
+                comment = 1;
             } else if (ctx->in->current[1] == '*') {
                 /* block comment */
-                MOVE_INPUT(ctx, 2);
-                LY_CHECK_GOTO(ret = skip_comment(ctx, 2), error);
+                comment = 2;
             } else {
                 /* not a comment after all */
                 LY_CHECK_GOTO(ret = buf_store_char(ctx, arg, word_p, word_len, word_b, &buf_len, 0, &prefix), error);
             }
+
+            if (comment) {
+                if (*word_len) {
+                    /* invalid comment sequence (RFC 7950 sec. 6.1.3.) */
+                    LOGVAL_PARSER(ctx, LYVE_SYNTAX, "Invalid comment sequence \"%.2s\" in an unquoted string.", ctx->in->current);
+                    ret = LY_EVALID;
+                    goto error;
+                }
+
+                /* skip the comment */
+                MOVE_INPUT(ctx, 2);
+                LY_CHECK_GOTO(ret = skip_comment(ctx, comment), error);
+            }
             break;
         case ' ':
             if (*word_len) {
diff --git a/tests/utests/schema/test_yang.c b/tests/utests/schema/test_yang.c
index 67f9747..034f95d 100644
--- a/tests/utests/schema/test_yang.c
+++ b/tests/utests/schema/test_yang.c
@@ -284,8 +284,6 @@
 
     TEST_GET_ARGUMENT_SUCCESS("hello ", YCTX, Y_STR_ARG, "hello ", 5, " ", 1);
 
-    TEST_GET_ARGUMENT_SUCCESS("hello/*comment*/\n", YCTX, Y_STR_ARG, "hello/*comment*/\n", 5, "\n", 1);
-
     TEST_GET_ARGUMENT_SUCCESS("\"hello\\n\\t\\\"\\\\\";", YCTX, Y_STR_ARG, "hello\n\t\"\\", 9, ";", 1);
     free(buf);