json BUGFIX opaq node cannot have an empty name
diff --git a/src/parser_json.c b/src/parser_json.c
index f3442d4..befe9a3 100644
--- a/src/parser_json.c
+++ b/src/parser_json.c
@@ -1217,6 +1217,13 @@
/* parse as an opaq node */
assert((lydctx->parse_opts & LYD_PARSE_OPAQ) || (lydctx->int_opts));
+ /* opaq node cannot have an empty string as the name. */
+ if (name_len == 0) {
+ LOGVAL(lydctx->jsonctx->ctx, LYVE_SYNTAX_JSON, "A JSON object member name cannot be a zero-length string.");
+ ret = LY_EVALID;
+ goto cleanup;
+ }
+
/* move to the second item in the name/X pair */
ret = lyjson_ctx_next(lydctx->jsonctx, &status);
LY_CHECK_GOTO(ret, cleanup);