webmcp
changeset 179:461e5353ffb1
Limit max depth of JSON documents to 50 (until a better implementation of json.export is available)
author | jbe |
---|---|
date | Sat Aug 02 00:38:25 2014 +0200 (2014-08-02) |
parents | 1a85110cdbe2 |
children | 887b77f71e5e |
files | libraries/json/json.c |
line diff
1.1 --- a/libraries/json/json.c Fri Aug 01 23:08:42 2014 +0200 1.2 +++ b/libraries/json/json.c Sat Aug 02 00:38:25 2014 +0200 1.3 @@ -13,6 +13,12 @@ 1.4 // this is detected nevertheless and an error is thrown (instead of 1.5 // returning nil and an error string). 1.6 #define JSON_MAXDEPTH 500 1.7 +// NOTE: As long as the function json_export_internal is implemented 1.8 +// recursively, JSON_MAXDEPTH needs to be low (e.g. 50) to avoid C stack 1.9 +// overflows. 1.10 +#if JSON_MAXDEPTH > 50 1.11 +#define JSON_MAXDEPTH 50 1.12 +#endif 1.13 1.14 // generate dummy memory addresses that represents null values: 1.15 char json_nullmark;