mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 18:11:28 +01:00
4ea1d13077
We use raw malloc here, again, to handle the failure cases more easily. I tested it with this hack, then ran the result through `jq --stream '.'` before and after to make sure it was the same. diff --git a/cli/lightning-cli.c b/cli/lightning-cli.c index f840c0786..d83555a51 100644 --- a/cli/lightning-cli.c +++ b/cli/lightning-cli.c @@ -295,6 +295,14 @@ static void oom_dump(int fd, char *resp, size_t resp_len, size_t off) exit(0); } +static void *xrealloc(void *p, size_t len) +{ + if (len > 1000000) + return NULL; + return realloc(p, len); +} +#define realloc xrealloc + int main(int argc, char *argv[]) { setup_locale(); Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> |
||
---|---|---|
.. | ||
test | ||
lightning-cli.c | ||
Makefile |