json BUGFIX limit for number encoded as a string
diff --git a/src/json.c b/src/json.c
index eee0e4f..440725a 100644
--- a/src/json.c
+++ b/src/json.c
@@ -425,6 +425,9 @@
             }
         }
 
+        LY_CHECK_ERR_RET((num_len + 1) > LY_NUMBER_MAXLEN, LOGVAL(jsonctx->ctx, LYVE_SEMANTICS,
+                "Number encoded as a string exceeded the LY_NUMBER_MAXLEN limit."), LY_EVALID);
+
         /* allocate buffer for the result (add terminating NULL-byte */
         num = malloc(num_len + 1);
         LY_CHECK_ERR_RET(!num, LOGMEM(jsonctx->ctx), LY_EMEM);