json UPDATE limit nested arrays as well
diff --git a/src/json.c b/src/json.c
index 5c45c8c..eeb7478 100644
--- a/src/json.c
+++ b/src/json.c
@@ -830,11 +830,7 @@
} else if (*jsonctx->in->current == '{') {
jsonctx->depth++;
- if (jsonctx->depth > LY_MAX_BLOCK_DEPTH) {
- LOGERR(jsonctx->ctx, LY_EINVAL,
- "The maximum number of block nestings has been exceeded.");
- return LY_EINVAL;
- }
+
/* object */
ly_in_skip(jsonctx->in, 1);
LY_CHECK_RET(lyjson_object(jsonctx));
@@ -850,6 +846,14 @@
return LY_EVALID;
}
+ if (jsonctx->depth > LY_MAX_BLOCK_DEPTH) {
+ LOGERR(jsonctx->ctx, LY_EINVAL, "Maximum number %d of block nestings has been exceeded.", LY_MAX_BLOCK_DEPTH);
+ return LY_EINVAL;
+ } else if (jsonctx->status.count > LY_MAX_BLOCK_DEPTH * 10) {
+ LOGERR(jsonctx->ctx, LY_EINVAL, "Maximum number %d of nestings has been exceeded.", LY_MAX_BLOCK_DEPTH * 10);
+ return LY_EINVAL;
+ }
+
return LY_SUCCESS;
}