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);
diff --git a/tests/utests/basic/test_json.c b/tests/utests/basic/test_json.c
index f17ea2e..b6db947 100644
--- a/tests/utests/basic/test_json.c
+++ b/tests/utests/basic/test_json.c
@@ -132,6 +132,10 @@
     assert_int_equal(1, jsonctx->dynamic);
     lyjson_ctx_free(jsonctx);
 
+    str = "1E1000";
+    assert_non_null(ly_in_memory(in, str));
+    assert_int_equal(LY_EVALID, lyjson_ctx_new(UTEST_LYCTX, in, &jsonctx));
+
     /* exp fraction number */
     str = "1.1e3";
     assert_non_null(ly_in_memory(in, str));